添加项目文件。
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace MongoRepository
|
||||
{
|
||||
public interface IMongoBaseRepository<TDocument> where TDocument : MongoBaseEntity
|
||||
{
|
||||
IQueryable<TDocument> AsQueryable();
|
||||
|
||||
IEnumerable<TDocument> FilterBy(Expression<Func<TDocument, bool>> filterExpression);
|
||||
|
||||
Task<List<TDocument>> FilterByAsync(
|
||||
Expression<Func<TDocument, bool>> filterExpression);
|
||||
Task<List<TDocument>> FilterByAsync(
|
||||
FilterDefinition<TDocument> filterExpression);
|
||||
IEnumerable<TDocument> FilterBy(FilterDefinition<TDocument> filterExpression);
|
||||
Task<long> CountAsync(
|
||||
Expression<Func<TDocument, bool>> filterExpression);
|
||||
|
||||
long Count(
|
||||
Expression<Func<TDocument, bool>> filterExpression);
|
||||
Task<long> CountAsync(
|
||||
FilterDefinition<TDocument> filterExpression);
|
||||
long Count(FilterDefinition<TDocument> 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 FindOne(FilterDefinition<TDocument> filterExpression);
|
||||
|
||||
Task<TDocument> FindOneAsync(FilterDefinition<TDocument> filterExpression);
|
||||
TDocument FindOne(FilterDefinition<TDocument> filterExpression, Expression<Func<TDocument, object>> orderExpression);
|
||||
|
||||
|
||||
Task<TDocument> FindOneAsync(FilterDefinition<TDocument> filterExpression, Expression<Func<TDocument, object>> orderExpression);
|
||||
|
||||
|
||||
TDocument FindOne(Expression<Func<TDocument, bool>> filterExpression, Expression<Func<TDocument, object>> orderExpression);
|
||||
|
||||
|
||||
Task<TDocument> FindOneAsync(Expression<Func<TDocument, bool>> filterExpression, Expression<Func<TDocument, object>> orderExpression);
|
||||
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, 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);
|
||||
|
||||
|
||||
Task<(long count, List<TDocument> list)> QueryPageAsync(Expression<Func<TDocument, bool>> filterExpression, Expression<Func<TDocument, object>> orderExpression, bool desc, int pageSize, int pageIndex, int skipIndex);
|
||||
|
||||
|
||||
Task<(long count, List<TDocument> list)> QueryPageAsync(FilterDefinition<TDocument> filterExpression, SortDefinition<TDocument> orderExpression, bool desc, int pageSize, int pageIndex);
|
||||
Task<(long count, List<TDocument> list)> QueryPageAsync(FilterDefinition<TDocument> filterExpression, SortDefinition<TDocument> orderExpression, bool desc, int pageSize, int pageIndex, int skipIndex);
|
||||
|
||||
|
||||
|
||||
(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) UpdateMany(FilterDefinition<TDocument> filterExpression, UpdateDefinition<TDocument> updateDefinition);
|
||||
Task<(bool ok, string message)> UpdateManyAsync(FilterDefinition<TDocument> 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);
|
||||
|
||||
|
||||
|
||||
Task<List<TDocument>> RandomData(Expression<Func<TDocument, bool>> filterExpression, int count);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user