Skip to content

Commit 2c29268

Browse files
Closes #27
1 parent 9b600eb commit 2c29268

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>
@@ -258,6 +250,18 @@ protected void ThrowIfEntityKeyValueTypeMismatch()
258250

259251
#endregion
260252

253+
#region Implementation of IRepositoryQueryable<out TEntity>
254+
255+
/// <summary>
256+
/// Returns the entity <see cref="System.Linq.IQueryable{TEntity}" />.
257+
/// </summary>
258+
public virtual IQueryable<TEntity> AsQueryable()
259+
{
260+
return GetQuery();
261+
}
262+
263+
#endregion
264+
261265
#region Implementation of ICanAggregate<TEntity>
262266

263267
/// <summary>

0 commit comments

Comments
 (0)