目标框架的变化4.0〜3.5休息EF模型。错误111:参照约束错误错误、框架、模型、目标

由网友(若能绽放光芒)分享简介:我创建了一个库项目,该项目面向.NET框架4.0的EF模型。我只是降级它的目标框架3.5,因为不是将使用这个库的目标3.5,不能在此刻升级项目之一。I created a EF model in a library project which targets .NET framework 4.0. I just do...

我创建了一个库项目,该项目面向.NET框架4.0的EF模型。我只是降级它的目标框架3.5,因为不是将使用这个库的目标3.5,不能在此刻升级项目之一。

I created a EF model in a library project which targets .NET framework 4.0. I just downgraded it to target framework 3.5 instead since one of the projects that will be using this library targets 3.5 and cannot be upgraded at the moment.

改变从4目标框架3.5,我越来越多111错误后类似于:

After changing the target framework from 4 to 3.5, I am getting multiple 111 errors similar to:

错误111:被称为属性   从属角色WfInstance必须是   所述的EntityType的密钥的子集   xx.Entity.WfInstance提到了   在引用从属角色   约束关系   xx.Entity.FK_WfInstance_WfStatusType。

Error 111: Properties referred by the Dependent Role WfInstance must be a subset of the key of the EntityType xx.Entity.WfInstance referred to by the Dependent Role in the referential constraint for Relationship xx.Entity.FK_WfInstance_WfStatusType.

我离开的消息是,我的表的(WfInstance)主键必须使用/包含引用的表的ID(WfStatusType),它引用的其它表。但是,我不知道如何做到这一点。

What I get out of the message is that my table's (WfInstance) primary key must use/contain the Id of the referenced table (WfStatusType) and any other tables it references. However, I am not sure how to do this.

任何帮助将是AP preciated。

Any help would be appreciated.

TIA - GP

TIA - GP

推荐答案

我想你已经选中(或左侧选中)的在模型中包含外键的,当你使用向导创建模型,.NET 4.0库。这是在.NET 4.0中的新功能,它可以不被降级到.NET 3.5。你会发现它很容易,因为你的实体将包含外键列的属性。有其中可以打破降级一些其他功能。总之相信我,如果你需要的型号为.NET 3.5的最佳方法是删除您EDMX并从头开始,因为手动修复损坏的模式将是该死的糟糕和长期任务。

I think you have checked (or left checked) Include foreign keys in the model when you used wizard to create model for .NET 4.0 library. This is a new feature in .NET 4.0 and it cannot be downgraded to .NET 3.5. You will find it easily because your entities will contain properties for foreign key columns. There are some other features which can break downgrading. Anyway believe me if you need model for .NET 3.5 the best way is deleting your EDMX and start from scratch because manually repairing broken model will be damn bad and long task.

阅读全文

相关推荐

最新文章