WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

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!

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages