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

前端 未结 2 1940
甜味超标
甜味超标 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:06

    Figured it out.

    When I first started the program I was using an ObjectContext with the .edmx.

    Then I read about EF 4.2 and decided to use DbContext.

    The problem was my .edmx file was generating classes, as well as the DbContext T-4s.

    The solution was to turn off code generation in the .edmx.

    So now, only the DbContext T-4s are generating my POCO classes.

    Hope this questions helps someone else in the future!

提交回复
热议问题