Search code examples
c#visual-studioentity-frameworkedmxentity-data-model

Entity Framework database-first workflow designer failed


I am trying to create EDM using Entity Framework's database-first workflow designer. It fails right after starting running with error message

Object reference not set to an instance of an object

However it creates an .edmx model with just 2 files instead of 4: [name].Designer.cs and [name].edmx.diagram. And those 2 files are missing: [name].Context.tt, [name].tt.

I have the latest version of VS (16.10.0) and EF (6.4.4) and store the DB on localhost, however tried to create EDM using different older versions of VS and EF and got the same result. Could I ask you for tip about what is wrong with what I do?

Thanks in advance

Error message

P.S. BTW [name].Designer.cs file contains errors related to a missing references of:

  • System.Data.Entity.Core.Objects.DataClasses.EdmSchemaAttribute,
  • System.Data.EntityClient,
  • System.Data.Objects and
  • System.Data.Objects.DataClasses.

In other words those references just cannot be added for some reason.

Screenshot of VS

UPD. Tried to do the same on another machine with other older version of VS and different versions of EF and the result is the same. And in that case DB was not stored locally.


Solution

  • If there are some inconsistencies between types of project containing Entity Relationship Data Model (.edmx item) and target project, it could cause such illogical error as one mentioned above. So it is always better to check out, whether ERDM containing project and target project do link to the same version of .NET Framework, respectively .NET Core.