I have created an ASP.NET Dynamic Data Entities Web Application project under Visual Studio 2010 and I have registered my Entity Framework context to the MetaModel in the Global.asax file :
DefaultModel.RegisterContext(typeof(MyModel), new ContextConfiguration() { ScaffoldAllTables = true });
I would like to allow the end-user to choose the SQL server used and thus to set an other Entity Framework context to the MetaModel with the corresponding connection string.
I don't understand how to resolve my issue because a registered context seems to not allow to unregister it.
the simple answer is you can't, well not easily it would have to be fudge where after changing the context the app restarted and this would affect ALL users DD was not designed for this soory.
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
Jerome Lambe...
0 Points
1 Post
How to dynamically change the connection string?
Mar 13, 2012 11:17 PM|LINK
Hello,
I have created an ASP.NET Dynamic Data Entities Web Application project under Visual Studio 2010 and I have registered my Entity Framework context to the MetaModel in the Global.asax file :
DefaultModel.RegisterContext(typeof(MyModel), new ContextConfiguration() { ScaffoldAllTables = true });I would like to allow the end-user to choose the SQL server used and thus to set an other Entity Framework context to the MetaModel with the corresponding connection string.
I don't understand how to resolve my issue because a registered context seems to not allow to unregister it.
Any idea?
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: How to dynamically change the connection string?
Mar 14, 2012 09:53 PM|LINK
the simple answer is you can't, well not easily it would have to be fudge where after changing the context the app restarted and this would affect ALL users DD was not designed for this soory.
Always seeking an elegant solution.