Postulate is a lightweight, code-first ORM built with Dapper that targets SQL Server and MySQL. By "lightweight" I mean that Postulate emphasizes coding simplicity via
IDbConnection extension methods for CRUD actions such as Save, Merge, and Delete. In this way, it mimics Dapper's extension method architecture.
As a code-first ORM, you can develop your model classes first, then continuously merge them to your back-end of choice using my commercial tool SQL Model Merge. SQL Model Merge is powered by my open-source SchemaSync. SQL Model Merge has no ORM or database dependency, and uses a Provider architecture to target different back-end databases and ORM libraries. However, Postulate is the only ORM currently implemented for SchemaSync. Note that I also offer a free command line merge tool here.
All Postulate methods are extension methods of
IDbConnection and accept a
TModel generic argument that represents the model class you're using.
TModel may be pure POCO; or, if you want some things like permission checks and row-level events, inherit your model class from Record.
The only design requirement for Postulate model classes is that they either
- have an [Identity] attribute that indicates the primary or unique key property, or
- have a property named Id.
Learn more about what you can do with model classes.
All CRUD methods have synchronous and async versions.
In the SQL Server package Postulate.SqlServer, there are three primary key types supported:
Guid. Import the appropriate namespace for the key type you want to use:
GuidKey respectively. See SQL Server CRUD Methods
The MySql package Postulate.MySql 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.