Unique Keys not recognized by Entity Framework

前端 未结 2 549
情书的邮戳
情书的邮戳 2021-01-05 01:40

I have two tables, Reports and Visualizations. Reports has a field, VisualizationID, which points to Visualization<

2条回答
  •  一整个雨季
    2021-01-05 02:21

    The EF is complaining because it sounds like you are using an FK Association - which means that the VisualizationID is a property of the Entity and there is a Visualization reference too - and you can't do this with FK Associations.

    If however you use Independent Associations - which means there is no VisualizationID property - you can narrow the cardinality.

    So the solution is to remove the VisualizationID property from the Entity, at which point you need to go ahead an map the association.

    Hope this helps

    Alex

提交回复
热议问题