Specifying location of .csdl / .ssdl / .msl Metadata files within the output assembly

一笑奈何 提交于 2019-12-10 14:14:35

问题


I have an EF project that containing my data model that I have been successfully using. The "Metadata Artifact Processing" option is set to "Embed in Output Assembly".

As the .edmx file was in the root folder of the project the metadata string used in the EntityConnectionStringBuilder was set to:

res://*/myProject.csdl|res://*/myProject.ssdl|res://*/myProject.msl

When I was restructuring the project, I moved the .ecdm file into a subfolder: /DataLayer/myProject/ and I changed the metadata string to:

res://*/DataLayer/myProject/myProject.csdl|res://*/DataLayer/myProject/myProject.ssdl|res://*/DataLayer/myProject/myProject.msl

This now causes an error ("The specified metadata path is not valid") but I can't see what's wrong with the folder path I've specified in the metadata.

I know that I can just move the .ecdm file back to the root but I've had this problem before and couldn't fix it - is there something obvious I'm missing?


回答1:


I finally worked it out.

The folders should be separated with '.' not '/'.

The correct format for the metadata is:

res://*/DataLayer.myProject.myProject.csdl|res://*/DataLayer.myProject.myProject.ssdl|res://*/DataLayer.myProject.myProject.msl

Hopefully this will save someone from banging their head against the wall for a while!



来源:https://stackoverflow.com/questions/9375124/specifying-location-of-csdl-ssdl-msl-metadata-files-within-the-output-ass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!