0

我有一个使用每个类型继承表的实体框架模型,但是当我使用 VS 数据生成计划时,它会在子表中产生重复的键,这对 EF 来说是个问题。有谁知道让这个工作的方法,以便子表没有重叠的键?

4

1 回答 1

1

For anyone else trying to do this, I found a solution. You can change the generation type of foreign keys to interger, and then assign ranges. So for example, my parent table generates 40 records. Then each of my 4 child tables generates 10 records by setting a 1:4 ratio on each. Then, I set the ID value for the first table to 1-10, for the second 11-20, etc. This works perfectly.

于 2010-06-02T00:59:46.380 回答