mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-23 11:12:50 +08:00

如:var postRepos = fsql.GetGuidRepository<Post>(a => a.TopicId == 1); postRepos CURD 方法都会以 lambad 条件作为查询或验证,Update/Insert验证错误时会抛出异常。 - ISelect 增加 First/FirstAsync;
34 lines
783 B
C#
34 lines
783 B
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FreeSql {
|
|
public interface IBasicRepository<TEntity> : IReadOnlyRepository<TEntity>
|
|
where TEntity : class {
|
|
TEntity Insert(TEntity entity);
|
|
|
|
List<TEntity> Insert(IEnumerable<TEntity> entitys);
|
|
|
|
Task<TEntity> InsertAsync(TEntity entity);
|
|
|
|
Task<List<TEntity>> InsertAsync(IEnumerable<TEntity> entitys);
|
|
|
|
int Update(TEntity entity);
|
|
|
|
Task<int> UpdateAsync(TEntity entity);
|
|
|
|
IUpdate<TEntity> UpdateDiy { get; }
|
|
|
|
int Delete(TEntity entity);
|
|
|
|
Task<int> DeleteAsync(TEntity entity);
|
|
}
|
|
|
|
public interface IBasicRepository<TEntity, TKey> : IBasicRepository<TEntity>, IReadOnlyRepository<TEntity, TKey>
|
|
where TEntity : class {
|
|
int Delete(TKey id);
|
|
|
|
Task<int> DeleteAsync(TKey id);
|
|
}
|
|
}
|
|
|