adamfoneil / Dapper.CX

A Crud library based on Dapper
MIT License
8 stars 1 forks source link

create a service wrapper that makes this more DI-friendly #8

Closed adamfoneil closed 4 years ago

adamfoneil commented 4 years ago

I still believe strongly in the IDbConnection extension method architecture, but static methods aren't very DI-friendly on the face of it. I think there should be an injectable object that provides the Crud methods. I've already done (something like) this before a couple times in specific apps, but there should be first-class support for this in Dapper.CX.

I'm picturing an abstract class with a GetConnection protected abstract method. It would likely get the connection string through the constructor. There would be public methods that surface the extension methods and handle the connection.