Dapper如何操作实体

首先要安装 Dapper.Contrib,直接从nuget安装即可。

dapper官方文档:http://dapper-tutorial.net/dapper

T Get<T>(id);
IEnumerable<T> GetAll<T>();
int Insert<T>(T obj);
int Insert<T>(Enumerable<T> list);
bool Update<T>(T obj);
bool Update<T>(Enumerable<T> list);
bool Delete<T>(T obj);
bool Delete<T>(Enumerable<T> list);
bool DeleteAll<T>();

支持插入、更新实体,批量插入、批量更新实体。

猜你喜欢

转载自www.cnblogs.com/dawenyang/p/9237128.html