I am trying to build an AspNetCORE WebAPI that has various endpoints you can post to get information from a database.
The problem I am running into is trying to use dependency injection at the root layer to bind my DAL. Each request on the endpoint will carry metadata for the initial catalog. So the connection string has to be built from the request and then opened.
I have built a generic interface to work with my repos and then built a class that implements the interface, but in that implementation it still requires a data source to be newed up which at that point I don't have the DB to connect to.
So this forces me to new up a connection on every request.
If I abstract the DAL into a manager and then use DI to bind the managers, I still am missing the intial catalog detail
The SQL dbs all have the same schema, the only difference is the db name.
Is there a way to bind my DAL at the root while still being able to specify the connection string?
Trying to do this without EF, currently trying to figure out a way to handle this with Tortuga.Chain.