Hello,
I realize that the title probably doesn't make any sense, so here's my situation.
I have two OpenAccess fluent models in my solution, each in its own project. The reason for this is that our database consists of many static, internally designed tables, and many dynamic, user-defined tables. The first model uses persistent classes for the known tables, and the second model uses artificial mapping for the unknown, user-defined tables.
The important thing to note is that the information required for the dynamic model exists in two of the tables from the static model. There's one table that describes the user-defined tables, and one table that describes the columns for each of those tables. This means that we need to create an instance of the static model within the PrepareMapping() of the dynamic model, so that we know what to map.
I've achieved the above procedure with great success, but the problem is that I can't for the life of me figure out how to get the connection string/backend info from a configuration file. The solution refuses to build, and it seems to be entirely due to the fact that I'm creating an instance of the static model during the mapping of the dynamic model.
I'm guessing that this behaviour has something to do with the Enhancer, but I'm not sure how to get around it. If I hard-code the connection/backend info, then it builds and works no problem. It's only when I try to get that info from a config file that everything blows up. Also, I've tested the ConfigurationManager.ConnectionStrings["foo"].ToString() call to ensure that it's working and returning the intended value, so it's not that.
Any ideas? I'm not sure how to pass a pre-loaded instance of the static model into the PrepareMapping() method or if that would even solve my problem.
Thanks,
-Cory