How to seed data with AddOrUpdate with a complex key in EF 4.3

后端 未结 2 2053
盖世英雄少女心
盖世英雄少女心 2020-12-12 14:32

I am trying to seed a development database with some test data.

I have used context.People.AddOrUpdate(p => p.Id, people)); with much success.

<
2条回答
  •  醉话见心
    2020-12-12 15:23

    If you got Only primitive types or enumeration types are supported in this context. because of using navigation property - consider adding foreign key property directly to the entity (maybe only with getter) and use it as Ladislav Mrnka proposed.

提交回复
热议问题