Skip to content
/ dade Public

"Dade" is an implementation of UnitOfWork and Repository pattern over Dapper mini-ORM.

License

Notifications You must be signed in to change notification settings

imaun/dade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dade

"Dade" is implementation of UnitOfWork and Repository pattern over 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.

using imun.Dade;
namespace Blog.Core.Data.Repositories
{
    public class BlogSet: DadeSet<Blog, int>
    {
        protected BlogSet(IDbTransaction transaction) : base(transaction)
        {
        }
    }
}
using imun.Dade;
namespace Blog.Core.Data.Repositories
{
    public class PostSet: DadeSet<Post, int>
    {
        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!

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!

Releases

No releases published

Packages

No packages published

Languages