繁体   English   中英

实体框架为不存在的实体生成错误

[英]Entity Framework generating error for entity that does not exist

在底部的错误详细信息中,Encoding和其他提到的实体都不属于我的项目。 还是我得到这个错误。 几个小时后没有任何更改,当我启动项目时突然产生此错误。 进行基于第一个实体框架的调用时,会发生此错误。

 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.

这是完整的:数据库类:> 这里

问题是表的列之一的数据类型不受支持。 一栏本身代表实体,我不知道如何。

我错误地定义了以下数据类型:

public ActionResult effectcolumn {get; set;}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM