AmpScm.RepoDb
A hybrid ORM library for .NET.
Install
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard |
README
RepoDB - a hybrid ORM library for .NET.
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.
Important Pages
- GitHub Home Page - to learn more about the core library.
- Website - docs, features, classes, references, releases and blogs.
Core Features
- Batch Operations
- Bulk Operations
- Caching
- Class Handlers
- Class Mapping
- Dynamics
- Connection Persistency
- Enumeration
- Expression Trees
- Hints
- Implicit Mapping
- Multiple Query
- Property Handlers
- Repositories
- Targeted Operations
- Tracing
- Transaction
- Type Mapping
Community Engagements
- 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.
License
Apache-2.0 - Copyright © 2019 - Michael Camara Pendon
Installation
At the Package Manager Console, write the command below.
Install-Package RepoDB
Or, visit our installation page for more information.
Get Started
After the installation, any library operation can then be called. Please see below for the samples.
Query
using (var connection = new SqlConnection(ConnectionString))
{
var customer = connection.ExecuteQuery<Customer>("SELECT * FROM [dbo].[Customer] WHERE (Id = @Id);", new { Id = 10045 }).FirstOrDefault();
}
Insert
var customer = new
{
FirstName = "John",
LastName = "Doe",
IsActive = true
};
using (var connection = new SqlConnection(ConnectionString))
{
var id = connection.ExecuteScalar<int>("INSERT INTO [dbo].[Customer](FirstName, LastName, IsActive) VALUES (@FirstName, @LastName, @IsActive); SELECT SCOPE_IDENTITY();", customer);
}
Update
using (var connection = new SqlConnection(ConnectionString))
{
var customer = new
{
Id = 10045,
FirstName = "John",
LastName = "Doe"
};
var affectedRows = connection.ExecuteNonQuery("UPDATE [dbo].[Customer] SET FirstName = @FirstName, LastName = @LastName, LastUpdatedUtc = GETUTCDATE() WHERE (Id = @Id);", customer);
}
Delete
using (var connection = new SqlConnection(ConnectionString))
{
var deletedRows = connection.ExecuteNonQuery("DELETE FROM [dbo].[Customer] WHERE (Id = @Id)", new { Id = 10045 });
}
StoredProcedure
using (var connection = new SqlConnection(ConnectionString))
{
var customer = connection.ExecuteQuery<Customer>("[dbo].[sp_GetCustomer]", new { Id = 10045 }, commandType: CommandType.StoredProcdure).FirstOrDefault();
}
Or via direct calls.
using (var connection = new SqlConnection(ConnectionString))
{
var customer = connection.ExecuteQuery<Customer>("EXEC [dbo].[sp_GetCustomer](@Id);", new { Id = 10045 }).FirstOrDefault();
}
Or, visit the official get-started page for SQL Server.
Changes from Previous Version
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.