CNative.Dapper.Utils
2.0.1-g46b6b60978
See the version list below for details.
dotnet add package CNative.Dapper.Utils --version 2.0.1-g46b6b60978
NuGet\Install-Package CNative.Dapper.Utils -Version 2.0.1-g46b6b60978
<PackageReference Include="CNative.Dapper.Utils" Version="2.0.1-g46b6b60978" />
paket add CNative.Dapper.Utils --version 2.0.1-g46b6b60978
#r "nuget: CNative.Dapper.Utils, 2.0.1-g46b6b60978"
// Install CNative.Dapper.Utils as a Cake Addin #addin nuget:?package=CNative.Dapper.Utils&version=2.0.1-g46b6b60978&prerelease // Install CNative.Dapper.Utils as a Cake Tool #tool nuget:?package=CNative.Dapper.Utils&version=2.0.1-g46b6b60978&prerelease
appsettings.json { "AppSettings": { "Title": "Test", "Version": "1.2.1", "AccessToken": "xxxxxx@abc.com" }, "connectionStrings": [ { "name": "BaseDb", "connectionString": "Data Source=.;Initial Catalog=test;Persist Security Info=True;User ID=sa;Password=xxxxxx", "providerName": "System.Data.SqlClient" }, { "name": "Oracle", "connectionString": "Data Source=xxxxxx;Persist Security Info=True;User ID=hispro;Password=xxxxxx", "providerName": "System.Data.OracleClient" }, { "name": "MySql", "connectionString": "server=xxxxxx;uid=root;pwd=xxxxxx;database=test", "providerName": "System.Data.MySql" }, { "name": "Sqlite", "connectionString": "DataSource=xxxxxx.db;Version=3;Pooling=False;Max Pool Size=100;", "providerName": "System.Data.Sqlite" }, { "name": "PostgreSql", "connectionString": "User id=postgres;Password=xxxxxx;Host=xxxxxx;Port=55433;Database=test;Pooling=true;", "providerName": "System.Data.Npgsql" }{ "name": "MsAccess", "connectionString": "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Public\Documents\DevExpress 2010.1 Demos\Components\ASPxEditors\CS\ASPxEditorsDemos\App_Data\nwind.mdb;Persist Security Info=False ", "providerName": "System.Data.Access" }, { "name": "MsAccess2", "IsUseMasterSlaveSeparation": true,//是否启用主从分离模式 "SlaveConnectStrings": [ "MsAccess", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Public\Documents\DevExpress 2010.1 Demos\Components\ASPxEditors\CS\ASPxEditorsDemos\App_Data\nwind.mdb;Persist Security Info=False " ],//从数据库连接字符串集合, "connectionString": "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Public\Documents\DevExpress 2010.1 Demos\Components\ASPxEditors\CS\ASPxEditorsDemos\App_Data\nwind.mdb;Persist Security Info=False", "providerName": "CNative.DbUtils.MsAccessProvider" } ] }
//测试用例 //测试用例 [TestClass] public class UnitTest461DbUtils { private ISqlBuilder DRY2 = null; private ISqlBuilder sqlBuilder = null;
//在运行每个测试之前,使用 TestInitialize 来运行代码 [TestInitialize()] public void MyTestInitialize() { DRY2 = new SqlBuilder("BaseDb"); sqlBuilder = new SqlBuilder("BaseDb");
} [TestMethod]
//单表操作测试 [TestMethod] public void TestSelectSqlBuilder1() { var lst = sqlBuilder.doSelect<Entity_persons>()//查询集合+排序+TOP .Fields(s ⇒ new { s.id, s.name, s.adress })//添加查询多个字段 .Top(8) // .Where(w ⇒ w.id.Between(10, 20)) .OrderByDescending(d ⇒ d.createTime)//按列倒向排序 .Query(); //返回结果 var lst3 = sqlBuilder.doSelect<Entity_persons>()//取单行+排序 .Fields(s ⇒ new { s.id, s.name, s.adress })//添加查询多个字段 .Where(w ⇒ w.id.Between(11, 20)) .OrderBy(d ⇒ d.id) //按列排序 .GetSingleRow(); //返回结果
var lst4 = sqlBuilder.doSelect<Entity_persons>().Count(w ⇒ w.id.Between(11, 20)); //返回结果 }
[TestMethod] public void TestInsertSqlBuilder1() { var jg = new Entity_DMJGXXB() { OrgId = 1002, jgdm = "56783", jgmc = "方舱医院" };
var ret = sqlBuilder.doDelete<Entity_DMJGXXB>()//实体删除 .Delete(jg) .Exec; ret = sqlBuilder.doInsert<Entity_DMJGXXB>()//插入实体 .Insert(jg) .Execute();
ret = sqlBuilder.doDelete<Entity_DMJGXXB>()//表达式删除 .Where(s ⇒ s.OrgId == 1003) .Execute(); ret = sqlBuilder.doInsert<Entity_DMJGXXB>()//表达式插入 .Insert(new Entity_DMJGXXB() { OrgId = 1003, jgdm = "532236783", jgmc = "方舱医院3", CreateId = 0, UpdateId = 0, CreateTime = DateTime.Now, UpdateTime = DateTime.Now }) .Exec;
//表复制 var ret1 = sqlBuilder.doDelete<Entity_DMCZYJGDYB2>() .Where(s ⇒ s.ksid == 1100453) .Execute();
var ret22 = sqlBuilder.doInsert<Entity_DMCZYJGDYB2>()//表复制 .InsertSelect<Entity_DMCZYJGDYB>(s ⇒ new Entity_DMCZYJGDYB2() { OrgId = s.OrgId, czyid = s.czyid, czyjgdyid = s.czyjgdyid, czyxm = s.czyxm, jgmc = "fasdfafdsaf", ksid = s.ksid, ksmc = s.ksmc }, s ⇒ s.ksid == 1100453) .Exec; } [TestMethod] public void TestUpdateSqlBuilder1() { var ret = sqlBuilder.doUpdate<Entity_DMJGXXB>() .Set(s ⇒ new Entity_DMJGXXB() { jgdm = "5322336783", jgmc = "fff232aaa", CreateId = 0, UpdateId = 0, jgjpm = "ffff", UpdateTime = DateTime.Now }) .Where(s ⇒ s.OrgId == jg.OrgId) .Exec;
jg.jgjpm = "345454"; ret = sqlBuilder.DoUpdate .Update(jg, "jgjpm");
var ret1 = sqlBuilder.doDelete<Entity_DMJGXXB>() .Where(s ⇒ s.OrgId == 1005) .Execute();
//更新或插入 var ret23 = sqlBuilder.DoUpdate .UpdateOrInsert(jg, w ⇒ w.OrgId == jg.OrgId);
ret = sqlBuilder.doUpdate<Entity_DMJGXXB>() .UpdateOrInsert(s ⇒ new Entity_DMJGXXB() { OrgId = 1006, jgdm = "5322336783", jgmc = "方舱医院232", CreateId = 0, UpdateId = 0, jgjpm = "wsafdasfd", CreateTime = DateTime.Now, UpdateTime = DateTime.Now }, w ⇒ w.OrgId == 1006); }
//多表操作测试 [TestMethod] public void TestSelectFieldExprSqlBuilder1() { //查寻时加集合函数 var ret1 = sqlBuilder.doSelect<Entity_DMCZYJGDYB2>() .Fields(f ⇒ new { czyjgdyid = f.czyjgdyid.SQL_MAX() }) .Where(s ⇒ s.ksid == 1100453) .GetSingle<object>();
var ret2 = sqlBuilder.doSelect<Entity_DMCZYJGDYB2>() .Fields(f ⇒ new { f.czyid, f.czyxm, jgmc = f.jgmc.SQL_UCASE(), ksmc = f.jgmc.SQL_SUBSTR(2, 3) }) //.Where(s ⇒ s.ksid == 1100453) .Where(s ⇒ s.ksid == 1100453 && s.jgmc.SQL_UCASE() == "FASDFAFDSAF") .Query();
var ret3 = sqlBuilder.doSelect<Entity_DMCZYJGDYB2>() .Fields(f ⇒ new { f.ksid, f.ksmc, czyjgdyid = f.czyjgdyid.SQL_MAX() }) .Where(s ⇒ s.OrgId == 1001) .GroupBy(g ⇒ new { g.ksid, g.ksmc }) .OrderBy(g ⇒ g.ksid) .Query();
var ret4 = sqlBuilder.doSelect<Entity_DMCZYJGDYB2>() .Fields(f ⇒ new { f.ksid, f.ksmc, czyjgdyid = f.czyjgdyid.SQL_COUNT(), czyid = f.czyjgdyid.SQL_MAX() }) .Where(s ⇒ s.OrgId == 1001) .GroupBy(g ⇒ new { g.ksid, g.ksmc }) .Having(h ⇒ h.czyjgdyid.SQL_COUNT() > 3 && h.czyjgdyid.SQL_MAX() > 0) .OrderBy(g ⇒ g.ksid) .Query(); }
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- CNative.Utilities (>= 2.1.11)
- Dapper (>= 2.0.90)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Data.OleDb (>= 5.0.0)
-
.NETFramework 4.0
- CNative.Utilities (>= 2.1.11)
- Dapper (>= 1.50.1)
-
.NETFramework 4.6.1
- CNative.Utilities (>= 2.1.11)
- Dapper (>= 2.0.90)
- System.ComponentModel.Annotations (>= 5.0.0)
-
.NETStandard 2.1
- CNative.Utilities (>= 2.1.11)
- Dapper (>= 2.0.90)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Data.OleDb (>= 5.0.0)
-
net5.0
- CNative.Utilities (>= 2.1.11)
- Dapper (>= 2.0.90)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Data.OleDb (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.377 | 646 | 5/13/2022 |
2.0.375 | 437 | 3/27/2022 |
2.0.374 | 427 | 3/26/2022 |
2.0.373 | 440 | 3/25/2022 |
2.0.372 | 424 | 3/25/2022 |
2.0.371 | 419 | 3/17/2022 |
2.0.37 | 471 | 3/17/2022 |
2.0.35 | 441 | 3/14/2022 |
2.0.34 | 459 | 3/11/2022 |
2.0.33 | 430 | 3/11/2022 |
2.0.32 | 449 | 3/10/2022 |
2.0.31 | 416 | 3/10/2022 |
2.0.30 | 437 | 2/10/2022 |
2.0.29 | 451 | 1/17/2022 |
2.0.28 | 427 | 1/17/2022 |
2.0.27 | 280 | 12/14/2021 |
2.0.26-gc5b80360e1 | 221 | 12/13/2021 |
2.0.25-gc3ae86d0a4 | 188 | 12/13/2021 |
2.0.24-g3c6a0dfbba | 209 | 12/13/2021 |
2.0.23-g73c97e6424 | 224 | 12/10/2021 |
2.0.21-g4da30d5c1e | 244 | 9/26/2021 |
2.0.20-g0174deb0b5 | 244 | 7/22/2021 |
2.0.14-gacd961bcfc | 281 | 7/21/2021 |
2.0.12-gf73eb78747 | 267 | 7/21/2021 |
2.0.5-g062d5c3918 | 234 | 7/21/2021 |
2.0.1-g46b6b60978 | 242 | 7/21/2021 |