在底部错误详细信息中,编码和其他提到的实体都不是我项目的一部分。我还是得到了这个错误。当我在几个小时后开始项目而没有更改时突然生成此错误。 在进行第一个基于实体框架的调用时会发生此错误。
One or more validation errors were detected during model generation:
Website1.Models.Encoding: : EntityType 'Encoding' has no key defined. Define the key for this EntityType.
ActionResults: : The referenced EntitySet 'ActionResults' for End 'ContentResult_ContentEncoding_Source' could not be found in the containing EntityContainer.
ActionResults: : The referenced EntitySet 'ActionResults' for End 'JsonResult_ContentEncoding_Source' could not be found in the containing EntityContainer.
Encodings: EntityType: EntitySet 'Encodings' is based on type 'Encoding' that has no keys defined.
ActionResults: EntityType: EntitySet 'ActionResults' is based on type 'ActionResult' that has no keys defined.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.Entity.ModelConfiguration.ModelValidationException: One or more validation errors were detected during model generation:
Website1.Models.Encoding: : EntityType 'Encoding' has no key defined. Define the key for this EntityType.
ActionResults: : The referenced EntitySet 'ActionResults' for End 'ContentResult_ContentEncoding_Source' could not be found in the containing EntityContainer.
ActionResults: : The referenced EntitySet 'ActionResults' for End 'JsonResult_ContentEncoding_Source' could not be found in the containing EntityContainer.
Encodings: EntityType: EntitySet 'Encodings' is based on type 'Encoding' that has no keys defined.
ActionResults: EntityType: EntitySet 'ActionResults' is based on type 'ActionResult' that has no keys defined.
这里是完整的:数据库类:> HERE
答案 0 :(得分:0)
问题在于不支持表格列之一的数据类型。专栏本身代表实体,我不知道如何。
错误地我定义了以下数据类型:
public ActionResult effectcolumn {get; set;}