Learn Dapper: https://www.learndapper.com/
Dapper Tutorial: https://dappertutorial.net/
Info
Version: | 2.0.0 |
Author(s): | Maxim Konstantinovski |
Last Update: | Tuesday, July 25, 2017 |
.NET Fiddle: | Create the first Fiddle |
Project Url: | https://github.com/mkonstan/Dapper.Data |
NuGet Url: | https://www.nuget.org/packages/Dapper.Data |
Install
Install-Package Dapper.Data
dotnet add package Dapper.Data
paket add Dapper.Data
Dapper.Data Download (Unzip the "nupkg" after downloading)
Dependencies
.NETFramework 4.0
- Dapper(>= 1.50.2)
- Dapper(>= 1.50.2)
- Dapper(>= 1.50.2)
- NETStandard.Library(>= 1.6.1)
- Microsoft.CSharp(>= 4.3.0)
- Dapper(>= 1.50.2)
- Microsoft.NETCore.App(>= 1.1.2)
Tags
***************************************
// To create an instance of database context inherit DbContext
class TestDb : DbContext
{
private const string ConnectionName = "DefaultConnection";
private TestDb()
: base(ConnectionName)
{ }
}
// execute multiple statatements using same connection
// connection and transaction (if needed)
var db = new TestDb();
db.Batch(s =>
{
s.BeginTransaction();
try
{
s.Execute([Your query]);
s.CommitTransaction();
}
catch
{
s.RollbackTransaction();
throw;
}
});
// using it with ninject
kernel.Bind<IDbContext>().To<TestDb>().InSingletonScope();.