Spryer.BuildTasks
0.9.11
dotnet add package Spryer.BuildTasks --version 0.9.11
NuGet\Install-Package Spryer.BuildTasks -Version 0.9.11
<PackageReference Include="Spryer.BuildTasks" Version="0.9.11" />
<PackageVersion Include="Spryer.BuildTasks" Version="0.9.11" />
<PackageReference Include="Spryer.BuildTasks" />
paket add Spryer.BuildTasks --version 0.9.11
#r "nuget: Spryer.BuildTasks, 0.9.11"
#:package Spryer.BuildTasks@0.9.11
#addin nuget:?package=Spryer.BuildTasks&version=0.9.11
#tool nuget:?package=Spryer.BuildTasks&version=0.9.11
Spryer.BuildTasks
The project provides MSBuild tasks to automate the generation of C# classes from SQL script files managed by the Spryer library's DbScriptMap
class. This simplifies the process of working with SQL scripts within a .NET project.
Usage
After installing the NuGet package you need to add several elements to your .csproj
file to configure the build task. This involves specifying the SQL script files and the desired output location and namespace for the generated C# classes. Here's an example:
<ItemGroup>
<EmbeddedResource Include="Scripts\MyScripts.sql">
<Generator>DbScriptMapCodeGenerator</Generator>
<CustomToolNamespace>MyProject.Scripts</CustomToolNamespace>
</EmbeddedResource>
<None Include="Scripts\InlineScripts.sql">
<Generator>DbScriptMapCodeGenerator</Generator>
<CustomToolNamespace>MyProject.Scripts</CustomToolNamespace>
</None>
</ItemGroup>
After the build completes, you can use the generated C# classes in your application code to access and execute the SQL scripts. Each class will contain extensions methods that correspond to the scripts defined in the SQL files. For example:
-- MyScripts.sql
--@query-first-default GetResult(@Id uniqueidentifier)
select * from Results where Id = @Id;
// Application code
using MyProject.Scripts;
// Accessing a script from the generated class
var connection = new SqlConnection(connectionString);
await connection.OpenAsync();
var result = await connection.GetResultAsync<ResultObject>(new { Id = resultId });
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
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 |
---|---|---|
0.9.11 | 180 | 6/14/2025 |