问题
I have DAL (model first entity framework 4.1) and Service which is using it in separate projects. Everything was working fine, but after some minor changes (for example I generated model from database) it stoppedd working. I am now getting metadata exception. After many hours of research I downloaded ILSpy and checked that inside DAL.dll there are no resources. My connection string looks like:
metadata=res://*/DataModel.TerminalRegistryModel.csdl|
res://*/DataModel.TerminalRegistryModel.ssdl|
res://*/DataModel.TerminalRegistryModel.msl;
ANd in EDMX file metadata artifact processing is set to Embed in Output Assembly. What can cause my problem?
回答1:
The standard metadata string looks like this:metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl
And this works fine in most cases. However, in some Entity Framework get confused and does not know which dll to look in. Therefore, change the metadata string to:metadata=res://nameOfDll/Model.csdl|res://nameOfDll/Model.ssdl|res://nameOfDll/Model.msl
来源:https://stackoverflow.com/questions/10803930/entity-framework-metadata-exception-no-csdl-ssdl-msl-in-dll-resources