Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.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# 如何在EF 6中生成视图_C#_.net_Entity Framework - Fatal编程技术网

C# 如何在EF 6中生成视图

C# 如何在EF 6中生成视图,c#,.net,entity-framework,C#,.net,Entity Framework,更新项目中的模型后,我无法再运行。我正在使用EF6。我必须在运行项目之前生成视图。生成视图时,我在“输出”选项卡中遇到以下错误: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'System.Data.Entity.Model

更新项目中的模型后,我无法再运行。我正在使用EF6。我必须在运行项目之前生成视图。生成视图时,我在“输出”选项卡中遇到以下错误:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'System.Data.Entity.ModelConfiguration.Configuration.EntityMappingConfiguration`1<!0> System.Data.Entity.ModelConfiguration.Configuration.EntityMappingConfiguration`1.ToTable(System.String, System.String)'.
   at ProTrans.Logix.Data.LogisticsDataContext.<OnModelCreating>b__0(EntityMappingConfiguration`1 m)
   at System.Data.Entity.ModelConfiguration.EntityTypeConfiguration`1.Map[TDerived](Action`1 derivedTypeMapConfigurationAction)
   at ProTrans.Logix.Data.LogisticsDataContext.OnModelCreating(DbModelBuilder modelBuilder) in d:\Release 30\New_Prod_102\Logix\ProTrans.Demo.Data\LogisticsDataContext.cs:line 264
   at System.Data.Entity.Internal.LazyInternalContext.CreateModelBuilder()
   at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
   at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.ForceOSpaceLoadingForKnownEntityTypes()
   at System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
   at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
   at Microsoft.DbContextPackage.DbContextPackage.GetObjectContext(Object context)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
   at CallSite.Target(Closure , CallSite , Type , Object )
   at Microsoft.DbContextPackage.Handlers.OptimizeContextHandler.OptimizeContext(Object context)
System.Reflection.TargetInvocationException:调用的目标已引发异常。-->System.MissingMethodException:找不到方法:“System.Data.Entity.ModelConfiguration.Configuration.EntityMappingConfiguration`1 System.Data.Entity.ModelConfiguration.Configuration.EntityMappingConfiguration`1.ToTable(System.String,System.String)”。
位于ProTrans.Logix.Data.LogisticsDataContext.b__0(EntityMappingConfiguration`1 m)
位于System.Data.Entity.ModelConfiguration.EntityTypeConfiguration`1.Map[TDerived](操作`1 derivedTypeMapConfigurationAction)
在d:\Release 30\New\u Prod\u 102\Logix\ProTrans.Demo.Data\LogisticsDataContext.OnModelCreating(DbModelBuilder modelBuilder)中的ProTrans.Logix.Data.LogisticsDataContext.OnModelCreating(DbModelBuilder modelBuilder):第264行
位于System.Data.Entity.Internal.LazyInternalContext.CreateModelBuilder()处
位于System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
位于System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput输入)
在System.Data.Entity.Internal.LazyInternalContext.InitializeContext()中
位于System.Data.Entity.Internal.InternalContext.ForceOSPaceLoadingForknowEntityTypes()处
位于System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()处
---内部异常堆栈跟踪的结束---
位于System.RuntimeMethodHandle.InvokeMethod(对象目标、对象[]参数、签名符号、布尔构造函数)
位于System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(对象obj,对象[]参数,对象[]参数)
在System.Reflection.RuntimeMethodInfo.Invoke(对象obj、BindingFlags invokeAttr、绑定器绑定器、对象[]参数、CultureInfo区域性)
位于System.RuntimeType.InvokeMember(字符串名称、BindingFlags BindingFlags、绑定器绑定器、对象目标、对象[]提供的参数、参数修改器[]修饰符、CultureInfo区域性、字符串[]namedParams)
在CallSite.Target(闭包、CallSite、对象、字符串、BindingFlags、对象、对象、对象)
在System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](调用站点,T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5)
在CallSite.Target(闭包、CallSite、对象、字符串、BindingFlags、对象、对象、对象)
位于Microsoft.DbContextPackage.DbContextPackage.GetObjectContext(对象上下文)
在System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](调用站点,T0 arg0,T1 arg1)
目标(闭包、调用站点、类型、对象)
位于Microsoft.DbContextPackage.Handlers.OptimizeContextHandler.OptimizeContext(对象上下文)

您的项目引用的.NET Framework版本是什么?编辑您的帖子以包含您的代码,我们无法调试它而无需使用一些东西。我在项目中使用.NET Framework 4.5。我刚刚在我的项目中将EF 5更新为EF 6,然后我按照一些步骤为现有视图生成视图。在数据库上下文中。