43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Hncore.Infrastructure.DDD
|
|
{
|
|
public interface IRepository<TEntity, TId> where TEntity : IEntity<TId>
|
|
{
|
|
TEntity FindById(TId id);
|
|
|
|
Task<TEntity> FindByIdAsync(TId id);
|
|
|
|
void Add(TEntity entity);
|
|
|
|
Task AddAsync(TEntity entity);
|
|
/// <summary>
|
|
/// 批量添加
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
void AddRange(List<TEntity> entity);
|
|
/// <summary>
|
|
/// 批量添加
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
Task AddRangeAsync(List<TEntity> entity);
|
|
/// <summary>
|
|
/// 批量修改
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
void UpdateRange(List<TEntity> entity);
|
|
/// <summary>
|
|
/// 批量删除
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
void RemoveRange(List<TEntity> entity);
|
|
|
|
void Remove(TEntity entity);
|
|
void Update(TEntity entity);
|
|
|
|
|
|
IQueryable<TEntity> GetQueryable();
|
|
}
|
|
} |