Skip to content

Extensions for using Csg.Data with Csg.Data.Dapper

License

Notifications You must be signed in to change notification settings

jusbuc2k/Csg.Data.Dapper

 
 

Repository files navigation

Csg.Data.Dapper

Dapper provides extension methods for IDbConnection. This library provides those same extensions for the Query Builder (IDbQueryBuilder) from Csg.Data.

CI and Pre-Release Feed

Build status

Early releases can be found on the CSG Public MyGet feed.

Get Started

Install the NuGet package

Example Usage

var activeProducts = await connection.QueryBuilder("dbo.Product")
    .Where(x => x.FieldEquals<bool>("IsActive", true))
    .QueryAsync<Product>();

Provided Dapper Methods

  • Query
  • QueryAsync
  • QueryFirst
  • QueryFirstAsync
  • QueryFirstOrDefault
  • QueryFirstOrDefaultAsync
  • QuerySingle
  • QuerySingleAsync
  • QuerySingleOrDefault
  • QuerySingleOrDefaultAsync

Other Methods

ToDapperCommand() provides a way to build a custom Dapper execution.

var dapperCmd = connection.QueryBuilder("dbo.Product")
    .Where(x => x.FieldEquals<bool>("IsActive", true))
    .ToDapperCommand();

// do something with native Dapper extension methods.
var data = await connection.QueryAsync(dapperCmd);
// etc

About

Extensions for using Csg.Data with Csg.Data.Dapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 83.0%
  • PowerShell 16.2%
  • Batchfile 0.8%