To get it working for any type of app, these 2 steps are sufficient:
- Add the app.config of the EFW project to your app. If you already have a app.config, then add only the "connectionStrings" node of it.
- Copy the c/m/s (.csdl, .msl and .ssdl) files to the bin directory, where the executable of the app resides.
But if you have to get this working for a web app, then
- Add the "connectionStrings" node to your web app's web.config.
- Copy c/m/s files to App_Data folder
- Change the string in "connectionStrings" node From
".\EFWSampleDb.csdl.\EFWSampleDb.ssdl.\EFWSampleDb.msl" To"DataDirectoryEFWSampleDb.csdlDataDirectoryEFWSampleDb.ssdlDataDirectoryEFWSampleDb.msl"
Alternately, instead of "|DataDirectory|EFWSampleDb.csdl" you can also say "~\App_Data\EFWSampleDb.csdl". ("~" refers to the root directory of the web app). So, this essentially means that you can have the m/s/l files in any directory, and not necessarily in App_Data, and reference it in web.config.
Failing to do the above steps may error out saying:
"The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource."
OR
"The specified named connection is either not found in the configuration, not intended to be used with the EntityClient Provider, not valid."
4 comments:
When I do that, the metadata error msg goes away, from I see this error:
Unknown model type MyCompany.Model.CompanyDb
for ADO.NET Entities Beta 3.
Did you get these two working together?
Where did you get the c/s/m files from? I only get an edmx file
Glen - look at the output build directory...
Thank you very much for this information, this was really helpful, had hours trying to find a solution.
Thanks
Alex :D
Post a Comment