Mongo仓储服务IService

  • binGe博客
  • 工具使用
  • 2024/1/24 16:38:16
  • 人已阅读
简介
using DingTalkService.NuGet.Mongo.Service;
using DingTalkService.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Driver;
using System.Linq.Expressions;
using MongoDB.Driver.Linq;

namespace DingTalkService.Service.IService.ICommonService
{
    /// <summary>
    /// Mongo仓储服务
    /// </summary>
    public interface IMongoRepository<TEntity, TKey> : IBaseService where TEntity : BaseEntity where TKey : struct
    {
        Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> Predicate);
        Task<long> HardDeleteAsync(TEntity Entity);
        Task<long> HardDeleteAsync(Expression<Func<TEntity, bool>> Predicate);
        Task<TEntity> InsertAsync(TEntity entity);
        Task<List<TEntity>> InsertManyAsync(List<TEntity> entities);
        IMongoQueryable<TEntity> Query();
        Task<List<TEntity>> ToListAsync(Expression<Func<TEntity, bool>> Predicate);
    }
}

 

上一篇:MongoDB实体定义

下一篇:Mongo仓储服务

文章评论

评论
  • 消灭零回复
Top