5

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?

rideronthestorm
  • 727
  • 1
  • 13
  • 32
  • I have recently run into this problem. In my solution, local builds have the metadata resources embedded. But in automated builds, the resources are missing. – Mike Bailey Apr 24 '13 at 12:31

1 Answers1

3

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

Meysam Savameri
  • 558
  • 2
  • 12
  • 30