Merge branch 'SqlSugar5' of github.com:sunkaixuan/SqlSugar

This commit is contained in:
skx
2020-12-19 15:15:40 +08:00

View File

@@ -1,5 +1,5 @@
## 😋果糖大数据科技(南通)有限公司(永久免费开源) ## ## 👨‍🎓果糖大数据科技(南通)有限公司(永久免费开源) ##
公司地址南通太阳晶城大厦3幢125室 公司地址南通太阳晶城大厦3幢125室
|qq|微信|Email|QQ Group| |qq|微信|Email|QQ Group|
@@ -8,14 +8,14 @@
服务项目:接收项目外包等服务(高级程序员&需求分析&软件架构师),技术咨询,技术顾问 服务项目:接收项目外包等服务(高级程序员&需求分析&软件架构师),技术咨询,技术顾问
## 👩中文文档: ## 👮‍♀️中文文档:
世界上最简单的ORM只需要配置连接字符串F5运行控制台自动建库建表运行DEMO 世界上最简单的ORM只需要配置连接字符串F5运行控制台自动建库建表运行DEMO
地址:http://www.codeisbug.com/Home/Doc <font color=#0099ff size=72> 地址:</font> http://www.codeisbug.com/Home/Doc
# 👵English documents # 🕵️‍♀️English documents
Using SqlSugar is very simple ,And it's powerful. Using SqlSugar is very simple ,And it's powerful.
@@ -24,19 +24,19 @@ SqlSugar=One object+One parameter=16 functions,
SupportMySql、SqlServer、Sqlite、Oracle 、 postgresql 、达梦、人大金仓 SupportMySql、SqlServer、Sqlite、Oracle 、 postgresql 、达梦、人大金仓
## Nuget ## 📮Nuget
|.net |.net core | |.net |.net core |
|---------| ---------| |---------| ---------|
|Install-Package sqlSugar |Install-Package sqlSugarCore| |Install-Package sqlSugar |Install-Package sqlSugarCore|
## SqlSugar's 16 Functions ## 📑SqlSugar's 16 Functions
There are 16 methods under SqlSugarClient There are 16 methods under SqlSugarClient
![输入图片说明](http://www.codeisbug.com/_theme/ueditor/utf8-net/net/upload/image/20190430/6369224056499802674782957.jpg?id=111 "sqlsugar") ![输入图片说明](http://www.codeisbug.com/_theme/ueditor/utf8-net/net/upload/image/20190430/6369224056499802674782957.jpg?id=111 "sqlsugar")
## 🎀Create SqlSugarClient ## 🎀 Create SqlSugarClient
All operations are based on SqlSugarClient All operations are based on SqlSugarClient
SqlSugarClient parameter and only one ConnectionConfig SqlSugarClient parameter and only one ConnectionConfig
@@ -81,7 +81,7 @@ public class Student
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/0.SqlSugarClient) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/0.SqlSugarClient)
## 🎉1. Queryable ## 🎉 1. Queryable
We use it to query We use it to query
![输入图片说明](http://www.codeisbug.com/_theme/ueditor/utf8-net/net/upload/image/20190502/6369240932997363035197459.png?id=1112 "Queryable") ![输入图片说明](http://www.codeisbug.com/_theme/ueditor/utf8-net/net/upload/image/20190502/6369240932997363035197459.png?id=1112 "Queryable")
@@ -120,7 +120,7 @@ var list4 = db.Queryable<Student, School>((st, sc) =>new JoinQueryInfos(JoinTyp
## 🎊2. Updateable ## 🎊 2. Updateable
We use it to Update We use it to Update
```cs ```cs
//update reutrn Update Count //update reutrn Update Count
@@ -162,7 +162,7 @@ var s9 = db.Insertable(insertObjs).InsertColumns(it => new { it.Name }).ExecuteC
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/3.Insertable) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/3.Insertable)
## 🎄4. Deleteable ## 🎄 4. Deleteable
We use it to Delete We use it to Delete
```cs ```cs
@@ -182,7 +182,7 @@ db.Deleteable<Student>().Where(it => it.Id == 1).ExecuteCommand();
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/4.Deleteable ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/4.Deleteable )
## 🎋5. SqlQueryable ## 🎋 5. SqlQueryable
```cs ```cs
var list = db.SqlQueryable<Student>("select * from student").ToPageList(1, 2); var list = db.SqlQueryable<Student>("select * from student").ToPageList(1, 2);
var list2 = db.SqlQueryable<Student>("select * from student").Where(it=>it.Id==1).ToPageList(1, 2); var list2 = db.SqlQueryable<Student>("select * from student").Where(it=>it.Id==1).ToPageList(1, 2);
@@ -190,7 +190,7 @@ var list3= db.SqlQueryable<Student>("select * from student").Where("id=@id",new
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/5.SqlQueryable ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/5.SqlQueryable )
## 🎎6. SaveQueues ## 🎎 6. SaveQueues
Perform multiple operations together with transactions Perform multiple operations together with transactions
```cs ```cs
var db = GetInstance(); var db = GetInstance();
@@ -212,7 +212,7 @@ var result2 = db.SaveQueues<Student, School, Student>();
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/6.queue ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/6.queue )
## 🎫7.Ado ## 🎫 7.Ado
db.Ado.MethodNameLook at the following example db.Ado.MethodNameLook at the following example
```cs ```cs
var dt=db.Ado.GetDataTable("select * from table where id=@id and name=@name",new List<SugarParameter>(){ var dt=db.Ado.GetDataTable("select * from table where id=@id and name=@name",new List<SugarParameter>(){
@@ -229,7 +229,7 @@ var dt2 = db.Ado.UseStoredProcedure().GetDataTable("sp_school",nameP,ageP);
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/7.ado ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/7.ado )
## 🧶8.Saveable ## 🧶 8.Saveable
Insert or Update Insert or Update
```cs ```cs
db.Saveable<Student>(entity).ExecuteReturnEntity(); db.Saveable<Student>(entity).ExecuteReturnEntity();
@@ -241,7 +241,7 @@ db.Saveable<Student>(new Student() { Name = "" })
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/8.saveable ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/8.saveable )
## 🛒9.EntityMain ## 🛒 9.EntityMain
```cs ```cs
var entityInfo=db.EntityMaintenance.GetEntityInfo<Student>(); var entityInfo=db.EntityMaintenance.GetEntityInfo<Student>();
foreach (var column in entityInfo.Columns) foreach (var column in entityInfo.Columns)
@@ -251,7 +251,7 @@ foreach (var column in entityInfo.Columns)
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/9.entityMain ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/9.entityMain )
## 🥼10.DbMain ## 🥼 10.DbMain
```cs ```cs
var tables = db.DbMaintenance.GetTableInfoList(); var tables = db.DbMaintenance.GetTableInfoList();
foreach (var table in tables) foreach (var table in tables)
@@ -262,7 +262,7 @@ foreach (var column in entityInfo.Columns)
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/a.DbMain ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/a.DbMain )
## 🦺11.Aop ## 🦺 11.Aop
```cs ```cs
db.Aop.OnLogExecuted = (sql, pars) => //SQL executed event db.Aop.OnLogExecuted = (sql, pars) => //SQL executed event
{ {
@@ -284,7 +284,7 @@ db.Aop.OnExecutingChangeSql = (sql, pars) => //SQL executing event (pre-exe
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/b.aop ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/b.aop )
## 🎁12.QueryFilter ## 🎁 12.QueryFilter
```cs ```cs
//gobal filter //gobal filter
@@ -347,7 +347,7 @@ db.CodeFirst.SetStringDefaultLength(100).InitTables(typeof(CodeTable), typeof(Co
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/e.CodeFirst ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/e.CodeFirst )
## 🧈15.Utilities ## 🧈1 5.Utilities
```cs ```cs
var list = db.Utilities.DataTableToList(datatable); var list = db.Utilities.DataTableToList(datatable);
``` ```
@@ -355,7 +355,7 @@ var list = db.Utilities.DataTableToList(datatable);
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/f.Utilities ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/f.Utilities )
## 🥫16.SimpleClient ## 🥫 16.SimpleClient
```cs ```cs
var db = GetInstance(); var db = GetInstance();
var sdb = db.GetSimpleClient<Student>(); var sdb = db.GetSimpleClient<Student>();
@@ -369,6 +369,6 @@ sdb.Update(obj);
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/g.SimpleClient ) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/g.SimpleClient )
# Code generator ## 🕹 Code generator
https://github.com/sunkaixuan/SoEasyPlatform https://github.com/sunkaixuan/SoEasyPlatform