Sikiro.Dapper.Extension - a simple lambda extension for dapper 中文
This is an extension based on dapper, supporting lambda expression, with chain style which allows developers to use more gracely and innovationally.
Package | NuGet |
---|---|
Sikiro.Dapper.Extension | |
Sikiro.Dapper.Extension.MsSql | |
Sikiro.Dapper.Extension.MySql | |
Sikiro.Dapper.Extension.PostgreSql |
PM> Install-Package Sikiro.Dapper.Extension.MsSql
PM> Install-Package Sikiro.Dapper.Extension.MySql
PM> Install-Package Sikiro.Dapper.Extension.PostgreSql
https://github.com/SkyChenSky/Sikiro.Dapper.Extension/wiki
Sikiro.Dapper.Extension is a library hosted in nuget. It can be used both on dotNet framework and dotNet Core.
The lambda expression encapsulation based on dapper is still an extension of IDbConnection
Interface, and retains and opens the original Execute
, Query
, etc
con.QuerySet<SysUser>().Where(a => a.Email == "287245177@qq.com")
.OrderBy(a => a.CreateDatetime)
.Select(a => new SysUser { Email = a.Email, CreateDatetime = a.CreateDatetime, SysUserid = a.SysUserid })
.PageList(1, 10);
con.CommandSet<SysUser>().Where(a => a.Email == "287245177@qq.com").Update(a => new SysUser { Email = "123456789@qq.com" });
var where = ExpressionBuilder.Init<SysUser>();
if (string.IsNullOrWhiteSpace(param.Email))
where = where.And(a => a.Email == "287245177@qq.com");
if (string.IsNullOrWhiteSpace(param.Mobile))
where = where.And(a => a.Mobile == "18988565556");
con.QuerySet<SysUser>().Where(where).OrderBy(b => b.Email).Top(10).Select(a => a.Email).ToList();
ToListAsync
GetAsync
InsertAsync
DeleteAsync
UpdateSelectAsync
UpdateAsync
[Table("SYS_USER")]
[Key]
[Required]
[StringLength(32)]
[Display(Name = "主键")]
[Column("SYS_USERID")]
[DatabaseGenerated]
Welcome to submit Pull Request for code changes. If you have any questions, you can open an issue for further discussion.