Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imaun/dade
"Dade" is an implementation of UnitOfWork and Repository pattern over Dapper mini-ORM.
https://github.com/imaun/dade
csharp dapper data-access dotnet dotnet-core mini-orm orm repository repository-pattern unitofwork uow-pattern
Last synced: about 1 month ago
JSON representation
"Dade" is an implementation of UnitOfWork and Repository pattern over Dapper mini-ORM.
- Host: GitHub
- URL: https://github.com/imaun/dade
- Owner: imaun
- License: gpl-3.0
- Created: 2020-03-12T12:40:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-27T13:49:28.000Z (over 4 years ago)
- Last Synced: 2024-05-29T19:46:59.112Z (8 months ago)
- Topics: csharp, dapper, data-access, dotnet, dotnet-core, mini-orm, orm, repository, repository-pattern, unitofwork, uow-pattern
- Language: C#
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dade
"Dade" is implementation of [UnitOfWork](https://www.martinfowler.com/eaaCatalog/unitOfWork.html) and
[Repository](https://martinfowler.com/eaaCatalog/repository.html) pattern over [Dapper](https://github.com/StackExchange/Dapper) mini-ORM.
Dade provides EntityFramework's like way for working with data using Dapper mini-ORM.
You can use this library to achieve UnitOfWork and Repository pattern with Dapper to create your Data-Access layer in some way like EF.# Sample usage
First thing first, install it via NuGet :
```Install-Package imun.Dade```In your data-access layer project, create repository or `DataSet` for each of your entities. Suppose you have two entities `Blog` and `Post`. Add two class named `BlogSet` and `PostSet` which will inherits from `DadeSet` class.
```c#
using imun.Dade;
namespace Blog.Core.Data.Repositories
{
public class BlogSet: DadeSet
{
protected BlogSet(IDbTransaction transaction) : base(transaction)
{
}
}
}
```
```c#
using imun.Dade;
namespace Blog.Core.Data.Repositories
{
public class PostSet: DadeSet
{
protected PostSet(IDbTransaction transaction) : base(transaction)
{
}
}
}
```
Well, that's it for repositories! Now add another class named `DbContext` or something like that to act as DbContext!```c#
public class DbContext: DadeContext
{
public DbContext(IUnitOfWorkFactory unitOfWorkFactory) : base(unitOfWorkFactory)
{
}public BlogSet Blogs { get; set; }
public PostSet Posts { get; set; }
}
```## About
`Dade` means Data in Farsi!