如何在EF 6中生成视图

时间:2017-05-23 15:16:39

标签: 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.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)

0 个答案:

没有答案