Skip to content

Commit 456e1b3

Browse files
Merge pull request #28 from johelvisguzman/feature/issue27
Closes #27
2 parents 332360b + 2c29268 commit 456e1b3

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

src/DotNetToolkit.Repository/IRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/// </summary>
99
/// <typeparam name="TEntity">The type of the entity.</typeparam>
1010
/// <typeparam name="TKey">The type of the primary key.</typeparam>
11-
public interface IRepository<TEntity, in TKey> : ICanAggregate<TEntity>, ICanAdd<TEntity>, ICanUpdate<TEntity>, ICanDelete<TEntity, TKey>, ICanGet<TEntity, TKey>, ICanFind<TEntity>, IDisposable
11+
public interface IRepository<TEntity, in TKey> : IRepositoryQueryable<TEntity>, ICanAggregate<TEntity>, ICanAdd<TEntity>, ICanUpdate<TEntity>, ICanDelete<TEntity, TKey>, ICanGet<TEntity, TKey>, ICanFind<TEntity>, IDisposable
1212
where TEntity : class
1313
{
1414
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace DotNetToolkit.Repository
2+
{
3+
using System.Linq;
4+
5+
/// <summary>
6+
/// Represents a repository that exposes a <see cref="System.Linq.IQueryable{TEntity}" />.
7+
/// </summary>
8+
/// <typeparam name="TEntity">The type of the entity.</typeparam>
9+
public interface IRepositoryQueryable<out TEntity> where TEntity : class
10+
{
11+
/// <summary>
12+
/// Returns the entity <see cref="System.Linq.IQueryable{TEntity}" />.
13+
/// </summary>
14+
IQueryable<TEntity> AsQueryable();
15+
}
16+
}

src/DotNetToolkit.Repository/RepositoryBase.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ public abstract class RepositoryBase<TEntity, TKey> : IRepository<TEntity, TKey>
5353
/// </summary>
5454
protected abstract IQueryable<TEntity> GetQuery(IFetchStrategy<TEntity> fetchStrategy = null);
5555

56-
/// <summary>
57-
/// Returns the entity <see cref="System.Linq.IQueryable{TEntity}" />.
58-
/// </summary>
59-
protected virtual IQueryable<TEntity> AsQueryable()
60-
{
61-
return GetQuery();
62-
}
63-
6456
/// <summary>
6557
/// Gets an entity query that satisfies the criteria specified by the <paramref name="criteria" /> from the repository.
6658
/// </summary>
@@ -276,6 +268,18 @@ protected void ThrowIfEntityKeyValueTypeMismatch()
276268

277269
#endregion
278270

271+
#region Implementation of IRepositoryQueryable<out TEntity>
272+
273+
/// <summary>
274+
/// Returns the entity <see cref="System.Linq.IQueryable{TEntity}" />.
275+
/// </summary>
276+
public virtual IQueryable<TEntity> AsQueryable()
277+
{
278+
return GetQuery();
279+
}
280+
281+
#endregion
282+
279283
#region Implementation of ICanAggregate<TEntity>
280284

281285
/// <summary>

0 commit comments

Comments
 (0)