Changing the target platform from 4.0 to 3.5 breaks the EF model. Error 111: referential constraint errors

I created an EF model in a library project that is designed for the .NET framework 4.0. I just downgraded it to the target environment of 3.5, because one of the projects that will use this library will have a value of 3.5 and cannot be updated at the moment.

After changing the target structure from 4 to 3.5, I get a few 111 errors, similar to:

Error 111: the properties specified in the Dependent Role of WfInstance should be a subset of the EntityType xx.Entity.WfInstance key referenced by the Dependent Role in the reference constraint for xx.Entity.FK_WfInstance_WfStatusType relationships.

What I get from the message is that the primary key of my table (WfInstance) should use / contain the identifier of the referenced table (WfStatusType) and any other tables that it refers to. However, I am not sure how to do this.

Any help would be appreciated.

TIA - GP

+4
source share
1 answer

I think you checked (or left the check box) Include foreign keys in the model when you used the wizard to create a model for the .NET 4.0 library. This is a new feature in .NET 4.0 and cannot be redefined until .NET 3.5. You will find this easy because your objects will contain properties for foreign key columns. There are other features that can break the slide. In any case, trust me if you need a model for .NET 3.5, the best way is to remove your EDMX and start from scratch, because manually repairing a broken model will be a hell of a bad and long task.

+3
source

All Articles