Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Context.cs is empty after updating from database, .edmx file generates it empty

I have an .edmx diagram, EF 6, sometimes when I update from database it just generates the Context.cs file empty and no class at all! We work in different teams so not always I can know exaclty what tables were updated.

Is there any error log I can use to sort this out? How can I debug and fix this issue when EF is in a bad mood?

like image 965
Hangarter Avatar asked Oct 09 '15 10:10

Hangarter


Video Answer


1 Answers

Ok I found a way around it.

You have to delete on the diagram one by one and save each time you delete an entity. When the buggy entity is discarded it will generate the classes again. At this moment you Update From Database and it updates everything nicely.

-- Update 10/12/20 --

Thanks to Dimitar that pointed out it could be confusing the deleting part: you don't need to delete all entities, just the problematic one (if you know which one it is). The approach to delete entities one by one is to find the problematic one.

like image 92
Hangarter Avatar answered Sep 23 '22 07:09

Hangarter