gpt4 book ai didi

entity-framework - 使用 Entity Framework 电动工具生成 View 时未找到方法异常

转载 作者:行者123 更新时间:2023-12-02 04:45:16 35 4
gpt4 key购买 nike

我正在处理一个包含几个项目的解决方案。一个处理我们的数据库上下文。使用 Entity Framework 6 和 Power Tools Beta 4,我右键单击 dbContext.cs 文件并选择“生成 View ”。我收到以下错误:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'System.Data.Entity.Core.Metadata.Edm.EdmModel System.Data.Entity.Infrastructure.DbModel.get_StoreModel()'.
at CodeFirstStoreFunctions.FunctionsConvention.Apply(EntityContainer item, DbModel model)
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.Dispatch[T](T item)
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.VisitEdmEntityContainer(EntityContainer item)
at System.Data.Entity.Edm.EdmModelVisitor.VisitCollection[T](IEnumerable`1 collection, Action`1 visitMethod)
at System.Data.Entity.Edm.EdmModelVisitor.VisitEntityContainers(IEnumerable`1 entityContainers)
at System.Data.Entity.Edm.EdmModelVisitor.VisitEdmModel(EdmModel item)
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.VisitEdmModel(EdmModel item)
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.Dispatch()
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ApplyStoreModel(DbModel model)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
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.LazyInternalContext.get_CodeFirstModel()
at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)
--- 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 Microsoft.DbContextPackage.Handlers.ViewContextHandler.ViewContext(MenuCommand menuCommand, Object context, Type systemContextType)

知道会发生什么吗?

最佳答案

我最近在使用相同版本的 EF Power Tools 时发生了这种情况,但在我重新启动系统并在 Visual Studio 中为解决方案进行干净构建后,问题就消失了。

我在其他论坛看到这个异常在其他扩展、工具和库中引发,通常是由仍然存在的旧版本库引起的,所以我猜 clean build 通过删除旧的编译来修复我拥有 DbContext 派生类并生成新类的库。

关于entity-framework - 使用 Entity Framework 电动工具生成 View 时未找到方法异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33618585/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com