EntityFramework Single connection string
I m beginner with EF,and my question is is there any way to use one connection string with multiple models.Because my application could have 50 models and it would be funny to change conn string in co开发者_Python百科nfig 50 times.
Thank you...
No. An EntityConnection provides 2 sets of information: Provider connection string which is basically the database connection string and is equal across all your models (albeit if you are accessing the same database on all of them) and Metadata Information which points to the Conceptual Schema Definition Layer (CSDL), Store Schema Definition Layer (SSDL), and Mapping Schema Layer (MSL) files, and tells the context where to find these files which is NOT equal across your models:
connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
provider connection string="Data Source=.;...."
The *only* way that you can have one connection string in your solution is to NOT have EDM files at all: **[Entity Framework Code First Development][1]**
精彩评论