Entity Framework Duplicate type name within an assembly (6.1.0)

前端 未结 10 1744
臣服心动
臣服心动 2020-12-29 01:41

I am not sure what is going on but I keep getting the following exception when doing a query. \"Duplicate type name within an assembly.\" I have not been able to find a solu

10条回答
  •  灰色年华
    2020-12-29 02:24

    With EF 6.1, I run into the same problem.

    In my case, my model has a self-reference table. So I found it might be caused by the following two reasons.

    1. //Database.SetInitializer(null) Just comment out the following line in DBContext constructor.
    2. keep foreign key and its corresponding navigation property consistent, or just keep the navigation property null

提交回复
热议问题