1

I am using Entity Framework 5.0 database first approach and I am unable to update model (edmx in Model browser) from database in Visual Studio 2022.

I have 3 models inside my solution and I am able to update other 2 that uses the same EF 5.0 as the one that throws exception (see below).

I am able to update the same model downloaded from same source control on any other computer or even on the same computer in Visual Studio 19. Normally I am using VS 22 so I guess something went wrong during normal usage.

System.Data.Entity.Core.EntityCommandCompilationException: An error occurred while preparing the command definition. See the inner exception for details. ---> System.NotImplementedException: The method or operation is not implemented.
   at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbExpressionConverter.Visit(DbApplyExpression expression)
   at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbExpressionConverter.Visit(DbProjectExpression expression)
   at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbExpressionConverter.Visit(DbFilterExpression expression)
   at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbExpressionConverter.Visit(DbProjectExpression expression)
   at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbProviderServicesWrapper.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)
   --- End of inner exception stack trace ---
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)
   at System.Data.Entity.Core.EntityClient.EntityCommand.CreateCommandDefinition()
   at System.Data.Entity.Core.EntityClient.EntityCommand.TryGetEntityCommandDefinitionFromQueryCache(EntityCommandDefinition& entityCommandDefinition)
   at System.Data.Entity.Core.EntityClient.EntityCommand.GetCommandDefinition()
   at System.Data.Entity.Core.EntityClient.EntityCommand.InnerPrepare()
   at System.Data.Entity.Core.EntityClient.EntityCommand.ExecuteReader(CommandBehavior behavior)
   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.LoadRelationships(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.GenerateModel(ModelBuilderSettings settings, IVsUtils vsUtils, ModelBuilderEngineHostContext hostContext)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.WizardPageBase.GenerateModel(ModelBuilderSettings settings)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.WizardPageUpdateFromDatabase.OnWizardFinish()
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.ModelBuilderWizardForm.OnFinish()
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I tried deleting all code and downloading it again from source control, repairing VS 22 through Visual Studio Installer, restarting computer and VS.

2
  • Don't expect developer tools to keep supporting ancient technology. Keep using VS 2019, or move on and abandon both EF5 and EDMX. You'll have to some day anyway. Don't give in too easily to reasons to postpone the inevitable. Commented Jul 4 at 19:11
  • Thank you @GertArnold for recommendation, but it is not my choice to work with this and there are reasons to do so. Also it is working for everyone else in team, and also for me for different models. Commented Jul 14 at 13:01

1 Answer 1

0

"Solved" by downgrading VS 2022 to Version 17.12.9

from

https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history#updating-your-installation-to-a-specific-release

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.