EF6 Entity Data Model Wizard extension gets error after Update Model From Database

315 Views Asked by At

I have a custom entity data model extension that implements IModelGenerationExtension. Without getting into specific code, I have come across a situation where I get the "A model generation extension made changes to the model generated from the database that were not valid." when updating my model from the database. I am able to completely step through my extension using the Visual Studio experimental instance. The xml document representing the EDMX file modified by extension is valid xml. The error occurs after the scope leaves my OnAfterModelGenerated method. I'm assuming I did something the EF entity data model wizard doesn't like. How can I determine what the actual error is? I find that info for this sort of thing is not readily available. Any help would be appreciated. Thanks in advance.

2

There are 2 best solutions below

0
On

Use OnAfterModelGenerated to edit the CurrentDocument only when WizardKind==WizardKind.Generate.

3
On

You can save the resulting .edmx as a new file and open it in Visual Studio. It will show the errors it has.