Is it possible for you to only initialize the EntityManager on those selected assemblies? This is so only selected assembly can access the Model and you never have to worry about validating the assembly.
- What I'm doing is that I have a class project and a static function that validates the calling assemble and returns an instance of an EntityManager.
E.g. from the calling assembly:
NorthwindIBEntities context = MyClass.GetNorthwindEntities();
Now, inside my GetNorthwindEntities function, I'm validating the calling assembly, and if it is permitted to have a connection to the database, It will return an instance of the EntityManager with the "Correct" datasourceextension and the calling assembly will have a connection to the database otherwise it can't connect to the database because it doesn't have the correct datasourceextension.
Do you mean that you want to change the SampleExtension's connectionString during runtime? If so, I don't believe this is possible. It wouldn't be a good idea either. You have to define another DataSourceExtension or change that SampleExtension's connectionString to point to VON2\SQL2008R2.
How can I do the underlined statement in runtime when it is already resolved? Another, what's the drawback of using multiple dynamic datasourceextension? I mean, how about defining different datasourceextension during Application startup? The idea here is to let the user choose his/her server and database to connect to.. Btw., I'm talking about a Windows Form Application in a LAN environment