GithubHelp home page GithubHelp logo

gitter-badger / postulate Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 165 KB

Lightweight code-first ORM made with Dapper for SQL Server and MySQL, targeting .NET Standard 2.0

Home Page: https://postulate-orm.io

License: MIT License

C# 100.00%

postulate's Introduction

Build status

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.

  • 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.

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.

postulate's People

Contributors

adamfoneil avatar devsoftnet555 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.