Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 23, 2013 05:45 AM by Talal Tayyab
Feb 22, 2013 08:30 PM|LINK
I find that a lot of the classes generated by EF (using the "Add Code Generation Item") EF 5.x DbContext Generator are great.
However, if you need to update any of these classes (by placing a foreignkey column or to flatten data from other classes), they are rendered useless.
You need to create ViewModel classes and place the code in there. If your model gets refreshed, I have to manually update my ViewModel classes that I created. You would also obviously lose your properties that you put in the generated class.
If there is a better way of reusing the generated classes from EF in the above type of scenario, I would love to hear about it....
Feb 23, 2013 05:45 AM|LINK
The classes are partial so you can add properties etc in your own partial class. Also to declare meta data information you can use the
MetadataType attribute (for example for data annoatations) and declare the annotations in a seperate class.