Why am I getting a NullReferenceException in System.Data.Entity.dll (Entity Framework)?

前端 未结 2 1870
说谎
说谎 2021-01-17 19:22

I have a List of State entity objects, and each State object has collections of other objects, such as Licenses

2条回答
  •  [愿得一人]
    2021-01-17 20:04

    I got the same problem when accidently loading a Module multiple times in a modular Architecture.

    Additional, the Module(s) where using 2 copies of the same DbContext, trying to connect one Entity from one Context to another Entity of the other Context.

    This masked the InvalidOperationException (cannot use an Entity in multiple Trackers), which occurs normally without the module stuff.

    Took me 3 hours to solve, maybe it helps people with the same problem

提交回复
热议问题