Everything you need to know about RepoDB
While developing any software or product, access to databases plays a very critical role. Therefore it is essential that it is designed carefully. For this very purpose, developers make use of ORM (Object Relational Mapping) which facilitates them to access data easily. Usage of an ORM library helps you speed up the development of any application while simplifying and solidifying the implementations. There are many popular ORM libraries that are used in the C# world such as Entity Framework, NHibernate, Dapper, LLBLGen Pro, RepoDB, etc. With so many options available to choose from, it's necessary that the developer chooses the most suitable ORM, one of which is definitely RepoDB.
In this post, let us understand in detail what is RepoDB and how it is beneficial for users.
Table of content:
- What is RepoDB?
- Why RepoDB
- Advantages of using RepoDB
- How to create RepoDB based applications?
- Conclusion
What is RepoDB?
Dapper is a micro-ORM framework that is known for its simplicity of code while Entity Framework core provides the programmer with auto-generated SQL. A hybrid ORM that has both these features is RepoDB. It stands for Repository Database. RepoDB is known for its features like correcting the patterns/programming structures, speeding up the development of an application and processing the company’s raw data in a faster way. RepoDBis a good option for developers as it provides the simplicity of Dapper while encapsulating some of the complex operations as Entity Framework Core.
Features of RepoDB
RepoDB is a lightweight, high-performance, efficient and dynamic hybrid ORM of the .NET framework. “High performance” here refers to how quickly the class objects are created from the raw data and this class object is transported to the database as actual data. “Efficient” here refers to the usage of memory by the ORM during the processing of the raw data to the database. As it provides features of both micro-ORM and full-ORM, RepoDB is considered a “hybrid-ORM”. Switching between the usage of “micro” and “full” operations is easy which gives flexibility to the developer while developing an application.
All the features of a micro-ORM are supported by the library as RepoDB can be used to perform Create Retrieve Update Delete (CRUD) operations via Raw SQL. A developer is given the flexibility to manipulate the data using method-based operations which are the features of full-ORM when using RepoDB.
The following are the features provided by RepoDB:
- Operations (Asynchronous)
- Recursive Query
- Cyclomatic Complexity
- Type Mapping
- Field Mapping
- Multiple Mapping
- Expression Tree
- Caching
- Tracing
- SQL Statement Builder
- Transactions
Advantages of RepoDB
Following are the important advantages of RepoDB which were kept in mind by the developers to make it better than the existing libraries:
- The performance/speed of the library constitutes its heart. Speed is the main reason behind using this library.
- All the operations performed by RepoDB are highly optimized as it consumes less computer memory.
- Switching between the usage of “micro” and “full” operations is easy in RepoDB which gives flexibility to the developer in the development of an application.
- RepoDB is a hybrid-ORM that has the potential to survive between lightweight ORMs like Dapper and massive ORMs like Entity Framework Core and NHibernate.
- By default, the library makes use of MemoryCache which is an internal class, thus providing a second-level caching mechanism.
How to get started with RepoDB based applications?
Here are the different steps to get started with RepoDB:
Step 1
Create a new ASP.NET Core Web API application by selecting Create a New Project in Visual Studio.
Step 2
Select the ASP.NET Core Web Application from the project template
Step 3
Now enter the name of your application. In the below example we have used RepoDB.demo.
Step 4
This is the last step in creating the project. In this, click on the API template option available. Keeping the values as default, click on the Create button to create the ASP.NET Core Web application
Step 5
After the project is created, you have to add the RepoDB Nuget package to this project. In order to do that, right-click on the name of the project and select the Manage NuGet Packages option.
Step 6
A package manager window opens in which you have to search for the RepoDb NuGet package. Now install version 1.11.3 of the RepoDb NuGet package.
Step 7
Once you are done with step 6, install the 1.0.10 version of RepoDb.SqlServer NuGet package. The NuGet package that is now installed has a dependency on the RepoDb NuGet package, Microsoft.Data.SqlClient NuGet package and System.Data.SqlClient Nuget package.
Conclusion
The repository Database is a very lightweight and simple library. Even though RepoDB is known to be a hybrid-ORM it is still considered as a micro-ORM since it does not provide many advanced features such as state tracking, change tracking, etc. RepoDB is particularly useful for those who are comfortable working with micro-ORM while making use of the operations that are provided by the full ORMs.