I realise that this has been asked a number of times but I just can\'t seem to get the bottom of my issue. I\'m getting the following error stack:
If you're trying to use more than one EDMX file and you have to put your new EDMX file in it's own namespace due to conflicts, when creating the EDMX file take note of the metadata the wizard shows you. That one is the correct one.
Then later if you are using EntityConnectionStringBuilder and are setting the Metadata there make sure you take into account the new namespace.
None of the answers here helped me as I had: /EDMX1 /Namespace/EDMX2
and while the metadata for the EDMX1 is "edmx1.csdl|edmx1.ssdl|edmx1.msl" The metadata for EDMX2 is "Namespace.edmx2.csdl ..."
I was having the same issue
System.Data.MetadataException: Unable to load the specified metadata resource
It turned out the Connection string which was generated earlier had all the edmx's name on it. I took out all the model names from the connection string leaving only the below string in my metadata
"metadata=res://*/;provider=System.Data.SqlClient;provider
This worked for me.
you should specify the assembly fully qualified name and a path to your model file within it(separated by /
), not the dll name
connectionString="metadata=res://Name.Of.The.Assembly, Culture=neutral, PublicKeyToken=8e2e51fcf4cf363e/Payment.PaymentModel.csdl|.........."
the same for ssdl
and msl
I am sharing my code with another developer and he had this problem.No connection string differences. All the files OK... I fixed it by setting
This worked, I assume, because the individual files (CSDL/MSL/SSDL files) were created in the output directory when it used "copy to output directory". Apparently there was a bug that required them for the embedded version to work. Hope this helps :)
I've hit this several times when moving between development machines after pulling down code from source control. I usually just have to explicitly rebuild the project with the EDMX file in it.
Change the metaData
connectionString="metadata=res://*/Entities.csdl|res://*/Entities.ssdl|res://*/Entities.msl;
To
connectionString="metadata=res://*/;
The above change will fix the issue