Ambient context implementation for Dapper.NET
Clone or download
sakopov Merge pull request #7 from sakopov/samples
Added samples and updated dependencies.
Latest commit 3b24435 Jul 17, 2018

README.md

Dapper.AmbientContext

Build status NuGet Pre Release

Ambient context implementation for Dapper.

Ambient Context is a little-known pattern which is frequently used by the .NET framework to address cross-cutting concerns such as security (Thread.CurrentPrincipal), logging (Trace & TraceListeners), HttpContext and etc. The general idea is that the application sets up a context, typically at an entry-point of an operation or web request, which becomes available to the rest of the system via a static property or method.

Dapper.AmbientContext uses a similar approach to treat the database connection and transaction as resources which are seamlessly shared between various data access components. This pattern works really well with the service layer which consumes multiple data access repositories, commands and queries to perform a variety of database tasks within the same transaction.

More information in the wiki.

Installation

Install Dapper.AmbientContext with NuGet

Install-Package Dapper.AmbientContext