Smooth.IoC.Dapper.Repository.UnitOfWork 0.1.0-CI00059

.NET Standard 1.6 .NET Framework 4.5.2
This is a prerelease version of Smooth.IoC.Dapper.Repository.UnitOfWork.
There is a newer version of this package available.
See the version list below for details.
NuGet\Install-Package Smooth.IoC.Dapper.Repository.UnitOfWork -Version 0.1.0-CI00059
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
dotnet add package Smooth.IoC.Dapper.Repository.UnitOfWork --version 0.1.0-CI00059
<PackageReference Include="Smooth.IoC.Dapper.Repository.UnitOfWork" Version="0.1.0-CI00059" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Smooth.IoC.Dapper.Repository.UnitOfWork --version 0.1.0-CI00059
#r "nuget: Smooth.IoC.Dapper.Repository.UnitOfWork, 0.1.0-CI00059"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Smooth.IoC.Dapper.Repository.UnitOfWork as a Cake Addin
#addin nuget:?package=Smooth.IoC.Dapper.Repository.UnitOfWork&version=0.1.0-CI00059&prerelease

// Install Smooth.IoC.Dapper.Repository.UnitOfWork as a Cake Tool
#tool nuget:?package=Smooth.IoC.Dapper.Repository.UnitOfWork&version=0.1.0-CI00059&prerelease

I made this project to fix the contradictory concepts behind the Repository and UnitOfWork patterns together with using inversition of control / dependancy injection. Also i wanted to make the resolving of sessions (IDbConnection) and UnitOFWork's (IDbTransaction) automatically connection / begin transaction on creation, and disconnect/commit on disposal.  
Also i wanted the usage of the session and uow to become nice and simple.  
This should cover 97% of your needs. But i have also insured the the Session and UoW types extend the ADO base interfaces, so you can basically do anything you like with the session / uow, because they are IDbConnection and IDbTransaction.

I have tried to insure it is as bare bones as possible. Only adding the system libraries needed and Dapper + Dapper.FASTCrud. The IoC of your choice is not included in the package,
but i have made example registrations for the "majors" look on the project site.  

*So far there are examples of Autofact, Castle.Windsor, Ninject, Simpleinjector, StructureMap, and Unity.*

     Included interfaces with abstractions:

1. **IDbFactory** is a simple interface that you register with your IoC. It can create/spwan ISession's and IUntOfWork's. But primary used in code to spawn sessions.
2. **ISession<TDatabase>** (and Session<TDatabase> abstraction): Extends IDbConnection. You use it to extend your Database connection / Session type. Yours session classes
and interfaces require a connection string. So If you have multiple database connections, you need 1 ISession and Session extended Interface and class per database. When the session is
created by the factory it connects to the database, when it disposes it discontects and disposes. For Castle Windsor it also untracks the object. You can use the session for any IDbConnection or dapper (or extension) framework you like, as ISession extends IDbConnection ;-).
3. **IUnitOfWork** (and UnitOfWork): Extends IDbTransaction. You don't need to extend anything with this. When you have created a session in you code, you can create a uow from the session. Then the session is created by the factory it begins a transaction (isolation i a parameter), when it disposes it commits (roleback on exception) and disposes. For Castle Windsor it also untracks the object. You can use the transaction for any IDbTransaction work you like as
IUnitOfWork extends IDbTransaction ;-).
4. **IRepository<TSession, TEntity, TPk>** (Repository<TSession, TEntity, TPk> abstraction): Is a default repository that you extend with your own repository for each of
the entities you want a repository for. There as some built in methods for GetAll, Get, and SaveOrUpdate. You can add the methods you need for your entity using any IDbConnection framework.
have used [dapper-dot-net]( and [dapper.FastCRUD]( for the quering.
5. **IEntity<TPk>**: An interface for your Entities so FastCRUD GetKey works in Repositories. To use this your table / entity should always have and Id column as Pk in
what every type you like (its a generic :-).
6. **IRepositoryBase** (and RepositoryBase<TEntity> abstraction): This is a vanilla base repository, you can use it if you do not want to use Dapper or Dapper.FastCRUD
and/or IEntity interface. It includes an protected method to set the dialect which you will need to do, if you want to use FastCRUD  but without the IEntity interface.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard1.6 netstandard2.0 netstandard2.1
.NET Framework net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen30 tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.9 1,819 3/28/2018
0.5.8 719 3/28/2018
0.4.21 1,915 3/26/2017
0.3.19 786 12/18/2016
0.2.73 886 12/3/2016
0.1.0-CI00059 859 11/26/2016