I've have an n-tier .NET 4.6 internal business application. It has a business logic layer class library project that references a data access layer class library project. It's designed to decouple the two so that, in theory, a different data access assembly could be swapped out without modifying the BLL.
But a new idea has just entered the picture. We want to use these projects to also support a public-facing website via a web service application. To help alleviate database server load (trying to avoid SQL Enterprise licensing), we had the idea, "what if we do some of our large read-only queries from a replicated database, while doing the less frequent inserts and updates to the master database?"
They will be identical databases so my DAL still works against both, but it simply connects to the single connection string its configuration file. I never planned on it choosing a data source at runtime so there could also be other ApplicationSettings
, static variables, possibly issues with managing the life of the DALs Entity Framework DbContext
lifetime... So it seems like what I really need is two parallel instances of that assembly. I could do that by creating two separate web service applications for each place, but could it be done within a single application? I have a feeling a total redesign with some kind of configuration DI is probably what is needed for this use case, but curious what the options are, if any, for running two parallel assembly instances/configurations.
AppDomain
s; one for each instance of my BLL/DAL pair. I think you could do that at runtime, but then every use of those libraries would be via reflection, and that would be ugly and without compile-time type checking, etc. At least without a wrapper or a commonInterface