Entity Framework 4.2 "The type is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute

前端 未结 2 1931
甜味超标
甜味超标 2021-02-15 11:41

I am receiving the following error:

System.InvalidOperationException was unhandled Message=The type \'Judge\' is not attributed with EdmEntityTypeAtt

2条回答
  •  礼貌的吻别
    2021-02-15 12:05

    I had a similar problem - it seems that in some cases (for example, when using WCF Data Services 5.2.0), it's a problem to have code-first/DbContext classes in the same assembly as EDMX/model-first/generated classes. For me, moving the DbContext classes into a separate assembly fixed the problem.

    Note that I didn't have a problem with code-first + model-first in the same assembly when just accessing the DB. But as soon as I added another layer (WCF Data Services) I ran into the EdmSchemaAttribute error.

提交回复
热议问题