添加第二个 .edmx 文件会使第一个文件在创建实体对象时停止处理元数据错误
对使用实体框架的分支进行 git 合并后,在不同数据库上使用实体已停止工作,并出现错误“元数据集合中不存在身份为“Path.To.Class”的成员”。
当执行以下代码行时会遇到此错误:
var databaseTable = database.CreateObject<Table>();
在网上查看其他人通过验证文件命名相同等解决了此问题。我已经这样做了,但没有运气。这些元数据存储和设置在哪里?我可以采取什么措施来修复它?
更新:通过一次手动合并一个文件,似乎导致此错误开始发生的原因是在将另一个 .edmx 文件添加到 .csprodj 文件时。此外,通过删除其他 .edmx 文件,它也可以重新开始工作。换句话说:在同一项目中包含第二个 .edxm 文件会破坏第一个文件!我该如何解决这个问题!
After a git merge of a branch that uses the Entity framework, using Entities on a different database have stopped working with the error "The member with identity 'Path.To.Class' does not exist in the metadata collection."
This error is encountered when the following line of code executes:
var databaseTable = database.CreateObject<Table>();
Looking online others solved this by verifying the files were named the same, etc. I have done this but with no luck. Where is this metadata stored and set and what can I do to fix it?
UPDATE: by manually merging in one file at a time, what seems to cause this error to start happening is when adding another .edmx file to the .csprodj file. Also, by deleting the other .edmx file it also started working again. In other words: including a second .edxm file in the same project is breaking the first! How can I solve this!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们能够通过删除两个 .edmx 和关联的 .tt 文件来解决此问题,然后对于每个文件,我们:
我的猜测是某些地方出现了不兼容的情况,特别是我们如何添加代码生成项。在此“删除所有内容并重试”解决方案之前,我们曾经对单个 .edmx 文件使用多个 .tt 文件 - 但现在情况已不再如此。
We were able to fix this by deleting the two .edmx and associated .tt files and then for each we:
My guess is somewhere things got incompatible, particuarlly on how we added code generation items. Prior to this "delete everything and try again" solution we used to have multiple .tt files for a single .edmx file--but this is no longer the case.