Asp.net mvc 在ASP MVC中,为什么除了create之外的所有视图都会在Transient.Collection方面给我这个错误?

Asp.net mvc 在ASP MVC中,为什么除了create之外的所有视图都会在Transient.Collection方面给我这个错误?,asp.net-mvc,view,model,transient,Asp.net Mvc,View,Model,Transient,我的create视图工作得很好,但是当我尝试运行create之外的每个视图时,会出现以下错误 'themeContext' is not a member of 'Transient.collection[MICSgroupHospital.Models.Theme(Nullable=True,DefaultValue=)]'. To extract a property of a collection element, use a sub-query to iterate over the c

我的create视图工作得很好,但是当我尝试运行create之外的每个视图时,会出现以下错误

'themeContext' is not a member of 'Transient.collection[MICSgroupHospital.Models.Theme(Nullable=True,DefaultValue=)]'. To extract a property of a collection element, use a sub-query to iterate over the collection. Near escaped identifier, line 1, column 16.

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.Core.EntitySqlException: 'themeContext' is not a member of 'Transient.collection[MICSgroupHospital.Models.Theme(Nullable=True,DefaultValue=)]'. To extract a property of a collection element, use a sub-query to iterate over the collection. Near escaped identifier, line 1, column 16.

Source Error: 


Line 18:         public ActionResult Index()
Line 19:         {
Line 20:             return View(db.themeContext.ToList());
Line 21:         }
Line 22: 

基本上,错误发生在任何需要在控制器的get方法中使用我的上下文类的视图上。可在此处找到更多详细信息:。我很抱歉问了两次同样的问题。不幸的是,我的回答没有得到任何结果,因此我采纳了stack overflow的建议,并使我的问题标题更具描述性。

可能的重复项>这将作为重复项删除。你知道你可以在发表文章后编辑标题。