Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EF System.MissingMethodException

I have a problem in generating the EF model from Database SqlCe, in a c# project. This is a new error because I've updated this many times in years. I try many things to resolve it, also researching on the web, but nothing help me to resolve. I've changed also the NET Framework to 4.6.2.

The C# project uses NETFramework 4.5 and EF 6.2, EF.SqlCe 6.2.

This is the error message:

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.

Any idea?

Thank you very much

like image 450
Tostone Avatar asked Nov 05 '25 04:11

Tostone


2 Answers

Running (as administrator) this command worked for me:

gacutil /u EntityFramework

A Visual Studio restart is needed then. The older version of assembly probably installed to GAC.

like image 181
SmartK8 Avatar answered Nov 08 '25 10:11

SmartK8


I have faced this issue using VS 2017. Below are the steps I have taken to get rid of this issue.

  1. Go to "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\EntityFramework" folder location
  2. Cut the "EntityFramework.dll" from the above folder and kept somewhere
  3. Go to the EF project and update the model without any error

Hope this will helps. Thanks.

like image 24
Prakash Avatar answered Nov 08 '25 08:11

Prakash