添加项目文件。
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
using System.Linq.Expressions;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using MongoRepository;
|
||||
|
||||
namespace CommonService
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument"></typeparam>
|
||||
public interface IMongoBaseService<TDocument> where TDocument : MongoBaseEntity
|
||||
{
|
||||
IQueryable<TDocument> AsQueryable();
|
||||
|
||||
IEnumerable<TDocument> FilterBy(
|
||||
Expression<Func<TDocument, bool>> filterExpression);
|
||||
|
||||
IEnumerable<TProjected> FilterBy<TProjected>(
|
||||
Expression<Func<TDocument, bool>> filterExpression,
|
||||
Expression<Func<TDocument, TProjected>> projectionExpression);
|
||||
|
||||
TDocument FindOne(Expression<Func<TDocument, bool>> filterExpression);
|
||||
|
||||
Task<TDocument> FindOneAsync(Expression<Func<TDocument, bool>> filterExpression);
|
||||
|
||||
TDocument FindById(string id);
|
||||
|
||||
Task<TDocument> FindByIdAsync(string id);
|
||||
|
||||
(long count, List<TDocument> list) QueryPage(Expression<Func<TDocument, bool>> filterExpression, Expression<Func<TDocument, object>> orderExpression, bool desc, int pageSize, int pageIndex);
|
||||
|
||||
Task<(long count, List<TDocument> list)> QueryPageAsync(Expression<Func<TDocument, bool>> filterExpression, Expression<Func<TDocument, object>> orderExpression, bool desc, int pageSize, int pageIndex);
|
||||
|
||||
(bool ok, string message) InsertOne(TDocument document);
|
||||
|
||||
Task<(bool ok, string message)> InsertOneAsync(TDocument document);
|
||||
|
||||
(bool ok, string message) InsertMany(ICollection<TDocument> documents);
|
||||
|
||||
Task<(bool ok, string message)> InsertManyAsync(ICollection<TDocument> documents);
|
||||
|
||||
(bool ok, string message) UpdateById(string id, UpdateDefinition<TDocument> updateDefinition);
|
||||
|
||||
Task<(bool ok, string message)> UpdateByIdAsync(string id, UpdateDefinition<TDocument> updateDefinition);
|
||||
|
||||
(bool ok, string message) UpdateMany(Expression<Func<TDocument, bool>> filterExpression, UpdateDefinition<TDocument> updateDefinition);
|
||||
|
||||
Task<(bool ok, string message)> UpdateManyAsync(Expression<Func<TDocument, bool>> filterExpression, UpdateDefinition<TDocument> updateDefinition);
|
||||
|
||||
(bool ok, string message) ReplaceOne(TDocument document);
|
||||
|
||||
Task<(bool ok, string message)> ReplaceOneAsync(TDocument document);
|
||||
|
||||
(bool ok, string message) DeleteOne(Expression<Func<TDocument, bool>> filterExpression);
|
||||
|
||||
Task<(bool ok, string message)> DeleteOneAsync(Expression<Func<TDocument, bool>> filterExpression);
|
||||
|
||||
(bool ok, string message) DeleteById(string id);
|
||||
|
||||
Task<(bool ok, string message)> DeleteByIdAsync(string id);
|
||||
|
||||
(bool ok, string message) DeleteMany(Expression<Func<TDocument, bool>> filterExpression);
|
||||
|
||||
Task<(bool ok, string message)> DeleteManyAsync(Expression<Func<TDocument, bool>> filterExpression);
|
||||
|
||||
Task<List<BsonDocument>> Aggregate(FilterDefinition<TDocument> filterExpression, ProjectionDefinition<TDocument, BsonDocument> group);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user