I have the same data model on a bunch of different servers. I want to dynamically create a connection string based on who my user is and what they are doing.
My users can have multiple databases on multiple servers. I need a clean way to build a connectoin string when I create my DomainService.
I see that the DomainService has an override (inherited from LinqToEntitiesDomainService) called CreateObjectContext() that would allow me to set any connection string I want, then return the new entity and life is good. The problem is, the CreateObjectContext() gets called after the constructor, so I can't set a string via an invoke method. Also, I've tried to create a new parameterized constructor on the DomainService, but it never gets copied to the DomainContext on the client.
The CreateObjectContext() would work great if I was able to pull my connection string, but since I have to use data from the client to figure out which DB to connect, this obviously won't work.
The more I think about it, the more I feel a custom constructor is exactly what I need - just can't figure out how to get that done.
What am I missing?