免费分享给大家。下载地址在最下面。
C# code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
var Sql = factorySql.Create<Users, InformationCategories>(); //简单查询,返回实体类列表。 var sdfsf123 = Sql.ExecuteList<Users>((a, b) => Sub.Top(8).Select(a.UserId, a.UserName).From(a)
);
//分页查询,返回表 DataTable dtUser = Sql.ExecuteDataTable((a, b) => Sub.PageSize(12).PageIndex(2).Select(a.UserId.As( "ID号" ), a.UserName.As( "名字" )).From(a).OrderBy(a.CreateDate.Desc())
); //多表查询 var ListUser3 = Sql.ExecuteList<Users>((a, b) => Sub.Top(12).Select().From(a).InnerJoin(b).On(a.UserId == b.CategoryId).Where(a.UserId == u1.UserId)
); //子查询 var ListUser8= Sql.ExecuteList<Users>((a, b) => Sub.Top(12).Select().From(a).Where(a.UserId.In(
Sub.Select(b.CategoryId).From(b).Where(b.CategoryName.Like( "Anna" ))))
); //居然还可以 同时执行同个语句。 var sdfsf1113 = Sql.ExecuteList<Users>((a, b) =>
Sub.Insert(a).Values( "213" , "111" , 11, "2012-02-02" ).
Next().
Select( "213" , "111" , 11, "2012-02-02" ).From(a).Where(a.UserId == 123)
); //数据库需要的都有,还有union,还有事务。大大缩短了我的开发时间。下面是插入,更新,删除。查询速度非常快。目前只支持sql server,听说oracle也快支持了哦。 //插入 Sql.ExecuteNonQuery((a) => Sub.Insert(a).Fields(a.UserName, a.RoleId, a.LoginPassword, a.CreateDate).Values( "Jane" , 11, "213" , DateTime.Now)
); //更新 var sdfsf6 = Sql.ExecuteNonQuery((a) =>
Sub.Update(a).Set(a.UserName == "1" ).From(a).Where(a.UserId == irod)
); //删除 var sdfsf2 = Sql.ExecuteNonQuery((a, b) => Sub.Delete(a).From(a) .Where(a.UserId == 1)
); |
这是下载地址,免费的: http://download.csdn.net/download/qq_25613869/8397495
更多0