@ -19,7 +19,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
{
public class MongoDbRepository < TMongoDbContext , TEntity >
: RepositoryBase < TEntity > ,
IMongoDbRepository < TEntity >
IMongoDbRepository < TEntity > ,
IMongoQueryable < TEntity >
where TMongoDbContext : IAbpMongoDbContext
where TEntity : class , IEntity
{
@ -167,7 +168,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
}
public override async Task < TEntity > FindAsync (
Expression < Func < TEntity , bool > > predicate ,
Expression < Func < TEntity , bool > > predicate ,
bool includeDetails = true ,
CancellationToken cancellationToken = default )
{
@ -322,6 +323,35 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
{
throw new AbpDbConcurrencyException ( "Database operation expected to affect 1 row but actually affected 0 row. Data may have been modified or deleted since entities were loaded. This exception has been thrown on optimistic concurrency check." ) ;
}
/// <summary>
/// IMongoQueryable<TEntity>
/// </summary>
/// <returns></returns>
public QueryableExecutionModel GetExecutionModel ( )
{
return GetMongoQueryable ( ) . GetExecutionModel ( ) ;
}
/// <summary>
/// IMongoQueryable<TEntity>
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public IAsyncCursor < TEntity > ToCursor ( CancellationToken cancellationToken = new CancellationToken ( ) )
{
return GetMongoQueryable ( ) . ToCursor ( cancellationToken ) ;
}
/// <summary>
/// IMongoQueryable<TEntity>
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public Task < IAsyncCursor < TEntity > > ToCursorAsync ( CancellationToken cancellationToken = new CancellationToken ( ) )
{
return GetMongoQueryable ( ) . ToCursorAsync ( cancellationToken ) ;
}
}
public class MongoDbRepository < TMongoDbContext , TEntity , TKey >
@ -331,7 +361,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
where TEntity : class , IEntity < TKey >
{
public IMongoDbRepositoryFilterer < TEntity , TKey > RepositoryFilterer { get ; set ; }
public MongoDbRepository ( IMongoDbContextProvider < TMongoDbContext > dbContextProvider )
: base ( dbContextProvider )
{
@ -376,4 +406,4 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
return RepositoryFilterer . CreateEntityFilter ( entity , withConcurrencyStamp , concurrencyStamp ) ;
}
}
}
}