Entities: Adding a Navigation Property between a View and Table

前端 未结 1 1068
闹比i
闹比i 2021-01-24 22:02

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

1条回答
  •  清酒与你
    2021-01-24 22:45

    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 tag for your view (), then there will be a element. Remove any non-key columns from that element.

    0 讨论(0)
提交回复
热议问题