RepoDB - a hybrid ORM library for .NET
Apr 2, 2020Introduction
Introducing RepoDB, a new high performant and efficient hybrid ORM library for .NET.
To begin with, you can start reading our Get Started page or learn more from our documentation.
Why use RepoDB?
- Easy installation, only takes few seconds.
- No controlled layer like
DbContext
, those make the developers speed-up the usability. - Calls to fluent and raw-SQL methods is just a dot away.
Repository
implementation becomes more simpler by leveraging the built-in repositories.- Can work without the models; everything can be
dynamics
. - Ease of pain when working with large data sets.
- Minimizes the round trips with
2nd-Layer
cache. - Transmission of data from different RDBMS DB Providers only take few lines of codes.
How does it works?
Basically, all operations were implemented as extended methods of the IDbConnection object. Once you hold the opened-state of your database connection object, you can then do all the activities you would like to do with your database through those extended methods.
See sample code snippets below:
For Query.
using (var connection = new SqlConnection(connectionString))
{
var customer= connection.Query<Customer>(10045).FirstOrDefault();
}
For Insert.
using (var connection = new SqlConnection(connectionString))
{
var customer = new Customer
{
Name = "John Doe",
Address = "New York"
};
var id = connection.Insert<Customer>(customer);
}
For Update.
using (var connection = new SqlConnection(connectionString))
{
var customer = new Customer
{
Id = 10045,
Name = "Jane Doe",
Address = "Chicago"
};
var rowsAffected = connection.Update<Customer>(customer);
}
And for Delete.
using (var connection = new SqlConnection(connectionString))
{
var deletedRows = connection.Delete<Customer>(10045);
}
You can also execute a raw SQLs via Execute
methods (i.e.: ExecuteQuery, ExecuteNonQuery, ExecuteScalar and ExecuteReader).
using (var connection = new SqlConnection(connectionString))
{
var customers = connection.ExecuteQuery<Customer>("SELECT * FROM [dbo].[Customer];");
}
Or even executing a stored procedure.
using (var connection = new SqlConnection(connectionString))
{
var customers = connection.ExecuteQuery<Customer>("sp_GetCustomersByState", new { State = "New York" }, commandType: CommandType.StoredProcedure);
}
Core Features
Below are the list of features available.
- Batch Operations
- Bulk Operations
- Caching
- Connection Persistency
- Enumeration
- Expression Trees
- Field/Class Mapping
- Hints
- Multiple Query
- Property Handlers
- Repositories
- Tracing
- Transaction
- Type Mapping
To learn more about these operation, please visit our documentation page.
Database Supports
The library supports the You can use the library to work with SQL Server, SQLite, MySQL and PostgreSQL Relational Database Management Systems (RDBMS).
Quality
It also covers a lot of real-world scenarios through its rich Unit Tests and Integration Tests.
Feedback
Please let us know about your feedback if you have some.
Lastly, please do not forget to share this to your friends and colleagues; give us your valuable STAR on our GitHub repository.
We are here to engage more with the .NET Community and collaborate further for the development of this library.