views:

228

answers:

2

As you can seen in the diagram below there is a one-to-many relationship between the ProjectTask and Dependency table.

Database Diagram

Entities tries to map every field in the View to fields in the Dependency table, which wouldn't work.

Any suggestions on how I can add the navigation property?

Thanks, Abe

+1  A: 

Here's the link to the Mapping diagram:

Mapping Diagram

AbeP
+1  A: 

By default, when you add a database view to your model, Entity Framework will assume every single column is part of the primary key. It does the same thing if you add a table without a primary key defined.

The solution is to manually edit the edmx file with an XML editor and define the primary key yourself. Find the <EntityType> tag for your view (<EntityType Name="MyView">), then there will be a <Key> element. Remove any non-key columns from that element.

Josh Hinman