A template engine for writing dynamic sql.
A template engine for writing dynamic sql:
sdmap has it's own benifics over other dynamic SQL package/framework (like iBatis.NET):
sdmap.ext.Dapper
You can just only install sdmap.ext.Dapper
since it will automatically install all dependencies including sdmap
and sdmap.ext
.
sql GetUserById
{
SELECT * FROM [User] WHERE Id = @Id
}
Note: the namespace NS { ... }
is not required.
Program
means the assembly where sdmap be located):DbConnectionExtensions.SetEmbeddedSqlAssembly(typeof(Program).Assembly);
Note:
SetSqlDirectory
- initialize from a physical on-disk folderSetSqlDirectoryAndWatch
- initialize from a physical on-disk folder, and watch changes when edit those folder sdmap filesSetEmbeddedSqlAssembly
- initialize from a single assembly, and sdmap automatically parse all the resource file that ends with .sdmap
SetEmbeddedSqlAssemblies
- initialize from multiple assemblies, and sdmap automatically parse all the resource file that ends with .sdmap
SetSqlEmiter
- advanced, you can write your own ISdmapEmiter
.string finalSqlToExecute = DbConnectionExtensions.EmitSql(sqlMapId, parameterObject);
https://marketplace.visualstudio.com/items?itemName=sdmapvstool.sdmapvstool
git clone https://github.com/sdcb/sdmap.git
)https://github.com/sdcb/sdmap/blob/master/ReleaseNotes.md