Page 1 of 1

Using same EDMX file for different schema

Posted: Fri 10 Jul 2009 12:10
by rranjan325
I have two databases with same Tables/Functions/Procedures etc. When I use same schema name in both databases then the EDMX does fine (Same EDMX can be used for both database by changing the connection string).

But, when the schema name (username in case of oracle 10g) is different then it gives me the compilation error.

Is there any way to use same EDMX file with different schema names? I wanted to use same database with two different schemas for two users so that both users can add/edit data only in their schema space.

Any help will be greatly appreciated.

Posted: Fri 10 Jul 2009 12:49
by AndreyR
You should remove Schema attribute from your .edmx file (use XML Editor to edit it).
Also, you'll have to remove the schema name from DefiningQueries and CommandTexts, if you have any in your model.
After performing these actions you should be able to switch between the contexts
simply creating a new instance of the context with proper connection from your configuration file.

What will happen when we update schema again?

Posted: Fri 10 Jul 2009 13:15
by rranjan325
Thanks for your suggestion.

But, the problem is whenever I take an update of the EDMX from database then the EDMX will be regenerated and hence the schema information comes again. So, again I will not be able to switch between users.

Is there any permanent solution?

Posted: Mon 13 Jul 2009 06:37
by AndreyR
Yes, Update model from database wizard discards changes made to the model.
As an alternative, you can use Entity Developer to generate the model.
The Store part of Devart Entity model is fully editable in design time.