Automagically generates C# database layers for stored procedures
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.nuget
Docs
NuGet
Storm.Cli
Storm.Dapper.Test
Storm.Dapper
Storm.Database
Storm.T4
Storm.Test
Storm
UserTest
.gitignore
LICENSE
README.md
Storm.sln

README.md

Storm

Automagically generates C# database layers for stored procedures. Generation can be done via a T4 template, a command line tool or by referencing the library directly.

Storm currently works for SQL Server only.

Features

  • Turns stored procedures into typed methods, contained within mockable C# classes
  • Generates classes for user defined types and passes them as IEnumerable<T> to table valued parameters
  • Presents OUT and INOUT parameters as ref-type parameters and updates them automatically
  • Each layer in the system can be customized using custom interface implementations

Project Info

Build Status

  • Nightly: alt text

Example

Code generation

Using T4

<#@ assembly name="$(TargetDir)Flyingpie.Storm.dll" #>
<#@ import namespace="Flyingpie.Storm" #>
<#
var generator = Generator.FromConnectionString("server=localhost;database=Storm;integrated security=true;");
Write(generator.Generate());
#>

Using command line

stormcli.exe --connection-string="server=localhost;database=Storm;integrated security=true;" --output="DB.cs"

Using library reference

var generator = Generator.FromConnectionString("server=localhost;database=Storm;integrated security=true;");
var code = generator.Generate();
File.WriteAllText("DB.cs", code);

Code usage

// Construct a sql executor
var executor = DapperSqlExecutor.FromConnectionString("server=localhost;database=Storm;integrated security=true;");

// Construct an accessor class, ProductCatalog is the name of the schema
var catalog = new ProductCatalog(executor);

// Retrieve some data
var result = catalog.GetProducts<SqlResponse<Product>>(2004, "Furniture", null);

// Profit
var productNames = result.Items.Select(p => p.Name);

Architecture

alt tag

License

MIT License