Simple.Data

Simple.Data is a lightweight framework that uses the dynamic features of .NET 4 to provide an expressive, ORM-ish way of accessing and manipulating data without any of the code pre-generation and boilerplate required by other frameworks.

Stored Procedures

Simple.Data allows you to call your existing stored procedures. There are three variations on calling procedures, Parameterless, Positional and with Named Parameters.

Procedure (Parameterless form)

The example procedure

CREATE PROCEDURE ProcedureWithoutParameters 
AS

SELECT * FROM Customers

Call it in Simple.Data with

db.ProcedureWithoutParameters();

This generates the following SQL

[ProcedureWithoutParameters]

Procedure (Positional Parameters form)

The example procedure

CREATE PROCEDURE ProcedureWithParameters 
@One VARCHAR(MAX),
@Two VARCHAR(MAX)
AS

SELECT * FROM Customers WHERE Firstname = @One and Lastname like @Two

Call it in Simple.Data with

db.ProcedureWithParameters(1, 2);

This generates the following SQL

[ProcedureWithParameters] @One, @Two
@One (AnsiString) = 1
@Two (AnsiString) = 2

Procedure (Named Parameters form)

The example procedure

CREATE PROCEDURE ProcedureWithParameters 
@One VARCHAR(MAX),
@Two VARCHAR(MAX)
AS

SELECT * FROM Customers WHERE Firstname = @One and Lastname like @Two

Call it in Simple.Data with

db.ProcedureWithParameters(One: 1, Two: 2);

This generates the following SQL

[ProcedureWithParameters] @One, @Two
@One (AnsiString) = 1
@Two (AnsiString) = 2