标签:type top 构造函数 insert nec 数据库连接字符串 sel roles 连表
SqlSuger,清垃圾ORM实战例子。
//添加引用 using SqlSugar; //在构造函数中实例化SqlSuger clinet = new SqlSugarClient(new ConnectionConfig() { InitKeyType = InitKeyType.Attribute, ConnectionString = "......",//这里是数据库连接字符串 DbType = SqlSugar.DbType.SqlServer, IsAutoCloseConnection = true }); //连表查询 BaseUserCollection con = new BaseUserCollection(); var query = clinet.Queryable<Base_Users, Base_Roles>((t1, t2) => t1.RoleID == t2.RoleID).Select<Base_Role_User>(); if(query != null) { con.List = await query.ToPageListAsync(pageIndex, pageSize); con.Count = await query.CountAsync(); } return con; //插入数据 return await clinet.Insertable(security).ExecuteReturnIdentityAsync();
标签:type top 构造函数 insert nec 数据库连接字符串 sel roles 连表
原文地址:https://www.cnblogs.com/nnnnnn/p/10874611.html