ExternalAPI_NET8/Common/MongoDB/IMongoDBHelper.cs
2026-05-21 17:23:36 +08:00

22 lines
756 B
C#

using System.Linq.Expressions;
using MongoDB.Driver;
using Web.Core.Model.Entity;
namespace Web.Core.Common.MongoDB;
public interface IMongoDBHelper<T> where T : MDBBaseEntity
{
public IList<T> Find(string collName, Expression<Func<T, bool>> match, string sortPropertyName,
bool isDescending = true);
public IList<T> Find(string collName, FilterDefinition<T> query, string sortPropertyName, bool isDescending = true);
public Task<IList<T>> FindAsync(string collName, FilterDefinition<T> query);
public IList<T> Find<TKey>(string collName, Expression<Func<T, bool>> match,
Expression<Func<T, TKey>> orderByProperty, bool isDescending = true);
public T FindSingle(string collName, FilterDefinition<T> filter);
}