SmartXmlSql 1.3.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package SmartXmlSql --version 1.3.6                
NuGet\Install-Package SmartXmlSql -Version 1.3.6                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SmartXmlSql" Version="1.3.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SmartXmlSql --version 1.3.6                
#r "nuget: SmartXmlSql, 1.3.6"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SmartXmlSql as a Cake Addin
#addin nuget:?package=SmartXmlSql&version=1.3.6

// Install SmartXmlSql as a Cake Tool
#tool nuget:?package=SmartXmlSql&version=1.3.6                

SmartXmlSql

XML配置SQL


使用
SqlGenerator.Instance.Builder();
SqlGenerator.Instance.Builder(new Person);传入参数值


生成实体代码

        var ss = new TableInfo() { TableName = "stud" };  
        ss.ColumnInfos.Add(new ColumnInfo() { ColumnName = "id", ColumnType = typeof(int), Description = "编号" });  
        ss.ColumnInfos.Add(new ColumnInfo() { ColumnName = "name", ColumnType = typeof(string), Description = "名称" });   
        DBCodeEntity.CreateCodeFile(ss, "ss.cs", "mytest", "myserver");   

         var lst=new List<TableInfo>();  
        lst.Add(ss);  
        DBCodeUtil.CreateDBEntity(lst,"mytest","");  

          DataSet ds = new DataSet();  
        DBCodeUtil.CreateDBEntity(ds, "mytest", "");  

增加扩展方法,实现参数简单转换
Dictionary<string,SqlValue> dicSql = new Dictionary<string,SqlValue>();
Dictionary<string,object> obj= dicSql.ToObjectParam();


SmartXmlSqlMaper.xsd 提示xml关键字


关键字说明

关键字 含义 使用 说明 样例
Statement 一个SQL语句节点 Id属性对应调用方法;DB属性对应数据库名称;Acess对应SQL语句类型(select,update,bath);Key对应实体关系 Key="Entity",用实体全部属性生成SQL,需要配置替换SQL;Key="Array",生成in的部分,方法传入数组,需要配置替换SQL;Key = "List",生成批量SQL语句,需要配置插入SQL的字段和参数,这样可以取实体的部分属性;Key ="Batch"生成批量语句,此时会用实体的全部属性生成,需要配置替换SQL。Key不是以上关键字,则按照参数匹配。 需要配置的替换SQL形如:insert into kk (<$p>) values(@p)
Where 生成条件语句 该关键字下有sql部分语句返回 则会增加where同时移除or,and开头部分
Choose 选择部分 子节点必须是When,Othersize,并且要同时存在,可以有default节点 子节点相当于IF ...else
When 选择 属性可以是IsNotEmpty或者Dynamic,IsNotEmpty判断实体属性是否为空;Dynamic为一般判断 为真则使用SQL部分,否则使用Othersize节点的SQL
Othersize 选择 When为假则用它的SQL部分
Switch 多项选择 使用子节点为真的部分SQL,子节点只能是Case,Default
Case 多项中的一项 为真则使用它的SQL部分
Set 更新语句的设置 将节点下的SQL加入SQL
Default 直接使用该节点 SQL语句直接拼接加入
Page 使用分页 该节点必须包含pagesize,pagenum这2个变量表达式 (pagenum-1)*pageSize
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.3.9 165 9/29/2023
1.3.8 138 9/25/2023
1.3.7 133 9/20/2023
1.3.6 148 5/15/2023
1.3.5 142 5/14/2023
1.3.4 161 4/19/2023
1.3.3 394 10/2/2021
1.3.2 408 10/2/2021
1.3.1 450 12/5/2020
1.3.0 365 12/3/2020
1.2.5 427 9/2/2020
1.2.4 497 4/12/2020
1.2.2 494 4/12/2020
1.2.1 505 4/11/2020
1.2.0 462 4/11/2020
1.1.0 525 4/5/2020
1.0.1 556 4/5/2020
1.0.0 515 3/30/2020

修改返回的参数,去除@