RepoDb.PostgreSql - a hybrid .NET ORM library for PostgreSQL.
RepoDB is an open-source .NET ORM library that bridges the gaps of micro-ORMs and full-ORMs. It helps you simplify the switch-over of when to use the BASIC and ADVANCE operations during the development.
- GitHub Home Page - to learn more about the core library.
- Website - docs, features, classes, references, releases and blogs.
- GitHub - for any issues, requests and problems.
- StackOverflow - for any technical questions.
- Twitter - for the latest news.
- Gitter Chat - for direct and live Q&A.
Apache-2.0 - Copyright © 2019 - Michael Camara Pendon
At the Package Manager Console, write the command below.
> Install-Package RepoDb.PostgreSql
Or, visit our installation page for more information.
First, the bootstrapper must be initialized.
RepoDb.PostgreSqlBootstrap.Initialize();
Note: The call must be done once.
After the bootstrap initialization, any library operation can then be called.
Or, visit the official get-started page for PostgreSQL.
using (var connection = new NpgsqlConnection(ConnectionString))
{
var customer = connection.Query<Customer>(c => c.Id == 10045);
}
var customer = new Customer
{
FirstName = "John",
LastName = "Doe",
IsActive = true
};
using (var connection = new NpgsqlConnection(ConnectionString))
{
var id = connection.Insert<Customer>(customer);
}
using (var connection = new NpgsqlConnection(ConnectionString))
{
var customer = connection.Query<Customer>(10045);
customer.FirstName = "John";
customer.LastUpdatedUtc = DateTime.UtcNow;
var affectedRows = connection.Update<Customer>(customer);
}
using (var connection = new NpgsqlConnection(ConnectionString))
{
var customer = connection.Query<Customer>(10045);
var deletedCount = connection.Delete<Customer>(customer);
}