Creating an entity is as simple as building a DLL in a T4 file and folder.
Using the T4 template Tutorial Step 1
Create a T4 template if you can't get it in my demo.
Step 2
Sets the order set required for the current T4 and references SqlSugar.dll
Writing Connection Database code
Call Sqlsugar to generate the entity function and fill in the parameters.
<#@ TemplateDebug= "false"hostspecific= "true"language= "C #" #><#@ Importnamespace= "System.Collections.Generic" #><#@ Assemblyname= "System.core" #><#@ Assemblyname= "System.Xml" #><#@ Assemblyname= "System.Xml.Linq" #><#@ Assemblyname= "System.Data" #><#@ Importnamespace= "System.Linq" #><#@ Importnamespace= "System.Text" #><#@ Importnamespace= "System.Collections.Generic" #><#@ Importnamespace= "Sqlsugar" #><#@ Importnamespace= "System.IO" #><#@ Importnamespace= "system.web" #><#@ Assemblyname= "$ (solutiondir) \webtest\app_lib\sqlsugar.dll" #><#//Current project directory stringProjectDir= Host.resolveassemblyreference ("$ (ProjectDir)"); //Solution directory string SolutionDir= Host.resolveassemblyreference ("$ (SolutionDir)"); using (Var db= newsqlsugarclient ("Server=.;i NitialCatalog=sqlsugartest; PersistSecurity Info=true; UserID=sa; Password=sasa ")){db. Classgenerating.createclassfiles (db, "E://t4/models", "Models"); };#>T4 Code
Step 3
Ctrl+s this T4 template, the entity file is generated, which is included in the project.
The demo is on Git.
Sqlsugar ORM from last year to now has been a year, version from 1.0 to 2.4 Now, this is a stable version, several companies have been projects on-line, Github ranked 7th in the C # most Star Search ORM.
Performance is currently tested down only Chloe ORM can be a higher, but also the following Chloe. The ORM second core-enabled ORM features a slightly higher performance than dapper. (Of course, if you have the test results, I can also send to the posts)
MySql. NET 4.0+
Https://github.com/sunkaixuan/MySqlSugar
MySql. NET CORE
Next week update
MSQL. NET 4.0+:
Https://github.com/sunkaixuan/SqlSugar
MSSQL. NET Core Version
Https://github.com/sunkaixuan/ASP_NET_CORE_ORM_SqlSugar
T4 template automatically generates annotated entity class files-requires only one SqlSugar.dll