C# MVC开发中在使用ADO.NET数据模型时出现的问题
ExceptionDetails:System.InvalidOperationException:Thetype'User'isnotattributedwithEdm...
Exception Details: System.InvalidOperationException: The type 'User' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute.
Model.edmx中有一个"Code Generation Strategy"的属性,将其设置为default时会出现以上问题,将其设置为None时,会出现以下的异常:
Message 4 The table/view 'OnlineShop.dbo.LineItem' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view. E:\Project\DotNet\WebSite1\App_Code\Model.edmx 0 1 WebSite1(1) 展开
Model.edmx中有一个"Code Generation Strategy"的属性,将其设置为default时会出现以上问题,将其设置为None时,会出现以下的异常:
Message 4 The table/view 'OnlineShop.dbo.LineItem' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view. E:\Project\DotNet\WebSite1\App_Code\Model.edmx 0 1 WebSite1(1) 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询