Skip to content
Lightweight code-first ORM made with Dapper for SQL Server and MySQL, targeting .NET Standard 2.0
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Build status Gitter

Postulate is a library of IDbConnection extension methods for SQL Server and MySQL made with Dapper. Here are examples with FindAsync and SaveAsync.

using (var cn = GetConnection())
  // find a record
  var order = await cn.FindAsync<Order>(id);
  // create and save
  var employee = new Employee()
    FirstName = "Whoever",
    LastName = "Nobody",
    HireDate = new DateTime(2002, 3, 13)
  await cn.SaveAsync<Employee>(employee);

Why another ORM framework?

  • Entity Framework is too big and complicated. Let's keep ORM lightweight, but capable. See the list of CRUD methods here. POCO is fine, but do more with Record and navigation properties. Learn more about model class requirements when using Postulate.

  • Code-first is a neat idea, but I don't want to write migrations. The SchemaSync project powers my database diff/merge commercial app SQL Model Merge. This isn't required, but it gives you a way to merge model classes to a physical database interactively.

  • In the end, inline SQL is more productive than Linq, but it needs to be isolated and testable with the Query class.

  • Sometimes I just want a simple, clean way to write INSERT and UPDATE Crud statements dynamically using dictionary syntax and no model classes. See SqlCmdDictionary

Getting Started

Install the Nuget package for your platform:

In the SQL Server package, there are three primary key types supported: int, long, and Guid. Import the appropriate namespace for the key type you want to use: Postulate.SqlServer.IntKey, LongKey, and GuidKey respectively. See SQL Server CRUD Methods

The MySql package supports only int key types via namespace Postulate.MySql.IntKey. See MySQL CRUD Methods

Both MySQL and SQL Server providers, as well as any new back-ends implemented should reference these base CRUD methods and surface them as extension methods.

Learn more at the Wiki.

You can’t perform that action at this time.