Skip to content

berkayyerdelen/NextLevel.Dapper.Repository

Repository files navigation

NextLevel.Dapper.Repository

Where can I use it?

You can use it in every .Net application or library targeting one of the following profiles:

  • .NET Standard 2.0
  • .NET Core 2.1+

You can also use it on previous version of these profiles but not fully tested.

https://www.nuget.org/packages/NextLevel.Dapper.Repository/1.0.0

List of Repository Methods?

  • GetAllAsync
  • GetByIdAsync
  • IsInDbAsync
  • RemoveAsync
  • UpdateAsync
  • AddAsync
  • ExecuteReadQuery
  • ExecuteWriteQuery

How to register service?

 static IServiceProvider RegisterService()
        {
            var collection = new ServiceCollection();
            collection.AddDapperRepository(
                "ConnectionString");
            return collection.BuildServiceProvider();
        }

Usage

var productService = service.GetService<IRepository<Product, int>>();
var source= await productService.GetAllAsync("TableName");
var source= await productService.GetAllAsync("TableName", "Fields");
var source= await productService.GetAllAsync("TableName", "Fields","WhereClause","Param"); 
var source= await productService.GetByIdAsync("TableName", "Fields", Id);
var source= await productService.GetByIdAsync("TableName", 1);
var source = await productService.IsInDbAsync("TableName", 1);
var source = await productService.IsInDbAsync("TableName","ColumnName","Param");
await productService.RemoveAsync("TableName", Id);
await productService.RemoveAsync("TableName", "WhereClause", "Param");
await productService.UpdateAsync("TableName", new Product() {Name = "AOM"});
await productService.UpdateAsync("TableName", new Product() {Name = "AOM"}, Id);
var source= await productService.ExecuteReadQuery("Select * from TableName");
await productService.ExecuteWriteQuery("Delete from TableName");
await productService.AddAsync("TableName", new Product() {Name = "Dota"});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages