错误3004:映射片段从线开始的问题 [英] Error 3004: Problem in mapping fragment starting at line

查看:149
本文介绍了错误3004:映射片段从线开始的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


错误3004:映射
片段时出现问题323:No
映射为属性
JE_TRN_HS.JE_HDR_HSJE_HDR_KEY指定。实体
是类型[TESTCPModel.JE_TRN_HS


这是发生了什么。
我从现有数据库创建了该实体数据模型。
我添加了2个表并重建了Web Service。这个构建是成功的。



我在两个表之间添加了一个关联。
当我尝试重建失败,并显示上面显示的错误信息!



现在这里是踢球者!我删除了新增的协会并重建。构建失败,出现相同的错误消息!
我可以摆脱这个错误的唯一方法是如果我删除第二个表,重建和重新添加第二个表?



我有看看这个问题的解决方案!
谢谢
Steve

解决方案

在我的情况下,我不允许修改现有的表,但是我发现您在EF4中添加了一个包含在模型中添加外键列的新表,并且该表不包含任何外键关系,那么您尝试添加关联将触发此错误。


在数据库中不存在的EF4模型中定义约束






如果链接的文章消失解决方案是:



您需要打开关联的属性窗口,然后单击参考约束椭圆以获得ref约束对话框。然后选择独立属性设置的正确字段。


I have this error when I build my Web Service:

Error 3004: Problem in mapping fragment starting at line 323: No mapping specified for properties JE_TRN_HS.JE_HDR_HSJE_HDR_KEY. Entity is type [TESTCPModel.JE_TRN_HS

This is what happend. I created this Entity Data Model from an existing database. I added 2 tables and rebuilt the Web Service. The build was successfull.

THEN I added an Association between the two tables. When I tried to rebuild it failed with the error message displayed above!

Now here's the kicker! I deleted the newly added Association and rebuilt. The build failed with the same error message!? The only way I can get rid of this error is if I delete the second table, rebuild and re-add the second table??

I've looked EVERYWHERE for the solution to this problem! Thanks Steve

解决方案

In my case am not allowed to modify existing tables but I discovered that when you add a new table with "Include foreign key columns in the model" checked in EF4 and the table doesn't contain any foreign key relationships then you try to add a association it will trigger this error.

Defining Constraints in an EF4 model that don’t exist in the database


In case the linked article disappears, The solution is:

You need to open the properties window of the association and then click on the Referential Constraint ellipses to get to the ref constraint dialog. Then select the correct field for the 'Dependent Property' setting.

这篇关于错误3004:映射片段从线开始的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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