gpt4 book ai didi

c# - EF System.MissingMethodException

转载 作者:行者123 更新时间:2023-12-05 01:17:26 27 4
gpt4 key购买 nike

我在 c# 项目中从 Database SqlCe 生成 EF 模型时遇到问题。这是一个新错误,因为多年来我已经更新了很多次。我尝试了很多方法来解决它,也在网上研究,但没有什么能帮助我解决。我还将 NET Framework 更改为 4.6.2。

C# 项目使用 NETFramework 4.5 和 EF 6.2、EF.SqlCe 6.2。

这是错误信息:

Generating the model took 00:00:30.5059377.
Unable to generate the model because of the following exception: 'System.MissingMethodException: Method not found: 'Boolean System.Data.Entity.Core.Common.DbProviderManifest.SupportsParameterOptimizationInSchemaQueries()'.
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.CreateFilteredCommand(String sql, String orderByClause, EntityStoreSchemaFilterObjectTypes queryTypes, List`1 filters, String[] filterAliases)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadDataTable[T](String sql, Func`2 orderByFunc, DataTable table, EntityStoreSchemaFilterObjectTypes queryTypes, IEnumerable`1 filters, String[] filterAliases)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadTableDetails(IEnumerable`1 filters)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadStoreSchemaDetails(IList`1 filters)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GetStoreSchemaDetails(StoreSchemaConnectionFactory connectionFactory)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateStoreModel()
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GenerateModel(List`1 errors)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModels(String storeModelNamespace, ModelBuilderSettings settings, List`1 errors)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModel(ModelBuilderSettings settings, IVsUtils vsUtils, ModelBuilderEngineHostContext hostContext)'.
Loading metadata from the database took 00:00:01.5131055.
Generating the model took 00:00:04.8109160.

有什么想法吗?

非常感谢

最佳答案

运行(作为管理员)这个命令对我有用:

gacutil /u EntityFramework

然后需要重新启动 Visual Studio。可能已将旧版本的程序集安装到 GAC。

关于c# - EF System.MissingMethodException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50561934/

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