指定输出程序集中 .csdl / .ssdl / .msl 元数据文件的位置

发布于 2025-01-07 09:36:48 字数 575 浏览 0 评论 0原文

我有一个 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 文件移回根目录,但我以前遇到过这个问题并且无法修复它 - 是否有一些明显的我丢失的东西?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

得不到的就毁灭 2025-01-14 09:36:48

我终于解决了。

文件夹应以“.”分隔不是 '/'。

元数据的正确格式是:

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

希望这能让某人暂时不用用头撞墙!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文