在输出程序集中指定.csdl / .ssdl / .msl元数据文件的位置 [英] Specifying location of .csdl / .ssdl / .msl Metadata files within the output assembly

查看:340
本文介绍了在输出程序集中指定.csdl / .ssdl / .msl元数据文件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含我已经成功使用的数据模型的EF项目。 元数据人工处理选项设置为嵌入输出装配。



由于.edmx文件位于项目的根文件夹中,因此使用的元数据字符串EntityConnectionStringBuilder设置为:



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



当我重组项目时,我将.ecdm文件移动到子文件夹:
/ DataLayer / myProject / ,我将元数据字符串更改为:



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



现在会导致错误(指定的元数据路径无效),但我看不到元数据中指定的文件夹路径有什么问题。



我知道我可以将.ecdm文件移回根目录,但我以前遇到过这个问题,无法解决它 - 有什么明显的'm missing?

解决方案

我终于明白了。



文件夹应该与'。'不分开'/'。



元数据的正确格式是:

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

希望这样可以让某人从头撞到墙上一段时间!


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?

解决方案

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!

这篇关于在输出程序集中指定.csdl / .ssdl / .msl元数据文件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆