2



I want to ask if I had a proper design.
Background:
I develop my web application with EF4. The application will be used by three offices. The business processes in the three offices is similar with each other. Each office has the database their own, but most tables, SPROCs in the databases are the same.
My thinking:
I want to extract the same tables and stored procedure to a single edmx file, and point the connection string to database at runtime basing on the logon user.

I add a method to the constructor

MPREntities(string connectionString, string containerName)

And will pass the connectionString and the container name, when initializing the MPREntities. The containerName is the same - "MPREntities", it does not depend on the databases pointed to. The connectionString will be changed according to the logon user before passing in. I have done some testing and seems it works. But is that a normal approach? any suggestions?

4

1 回答 1

0

That approach will work, and is a good use case for this.

于 2013-08-06T13:09:14.890 回答