Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 实体框架为不存在的实体生成错误_C#_Asp.net_Asp.net Mvc_Visual Studio_Entity Framework - Fatal编程技术网

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

C# 实体框架为不存在的实体生成错误,c#,asp.net,asp.net-mvc,visual-studio,entity-framework,C#,Asp.net,Asp.net Mvc,Visual Studio,Entity Framework,在底部错误详细信息中,编码和其他提到的实体都不是我项目的一部分。但我还是犯了这个错误。这个错误是在我启动项目的几个小时后突然产生的,没有任何改变。 在进行第一次基于实体框架的调用时发生此错误 One or more validation errors were detected during model generation: Website1.Models.Encoding: : EntityType 'Encoding' has no key defined. Define the ke

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

 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;}

问题在于不支持的表列之一的数据类型。列本身表示为实体,我不知道如何表示

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

public ActionResult effectcolumn {get; set;}

似乎您忘记为所需的表列ID放置
KeyAttribute
。检查它们是否正确插入到数据模型中。我交叉检查了两次,每个实体都有键属性。以下不是我的实体你能提供相关的模型类哪一个抛出错误?通过使用相应的模型类,您尝试了什么?在这里的abroadtutor.com/test.txt链接,上面也提到了,您似乎忘记为所需的表列ID放置
KeyAttribute
。检查它们是否正确插入到数据模型中。我交叉检查了两次,每个实体都有键属性。以下不是我的实体你能提供相关的模型类哪一个抛出错误?您使用相应的模型类尝试了什么?这里是abroadtutor.com/test.txt链接,上面也提到过