Answered by:
Update Model From Database

Question
-
Is there a way to force the "Update Model From Database" feature to update things like data type lengths, nullability, etc.? Is there a list of what's updated and what's not?
I will often find myself, especially early in a project, making quite a few changes at the database level as I learn more about my requirements. Having to update these in two places somewhat defeats part of the purpose of using EF to begin with.
I'm using EF 4.0, btw.
Friday, May 7, 2010 5:13 PM
Answers
-
Hello RMD,
Welcome to EF forum!
I think “Update Model from Database” will automatically update the data type lengths and nullability, however, it only updates the SSDL (storage model) of the .edmx. But, the CSDL (conceptual model) is designed to be maintained by the users. Generally, “Update Model from Database” won’t refresh the CSDL section unless no mapping properties is defined at the conceptual model, e.g. we add a new column in the database and then use “Update model from database”, EF will add a new property at the CSDL in this case. Also, imaging we have many inheritance, merging and splitting tables in the EDM, if “Update Model from Database” refreshes the CSDL, our manual modification of the EDM will be lost.
So please verify that whether the SSDL section is updated after “Update Model from Database”. If it is not, there could be some potential issues.
Have a nice day!
Best Regards,
Lingzhi SunMSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Proposed as answer by David DeWinter - MSFTEditor Monday, May 10, 2010 2:58 PM
- Marked as answer by Michael Sun [MSFT]Microsoft employee Monday, May 17, 2010 1:49 AM
Monday, May 10, 2010 2:29 AM
All replies
-
Hello RMD,
Welcome to EF forum!
I think “Update Model from Database” will automatically update the data type lengths and nullability, however, it only updates the SSDL (storage model) of the .edmx. But, the CSDL (conceptual model) is designed to be maintained by the users. Generally, “Update Model from Database” won’t refresh the CSDL section unless no mapping properties is defined at the conceptual model, e.g. we add a new column in the database and then use “Update model from database”, EF will add a new property at the CSDL in this case. Also, imaging we have many inheritance, merging and splitting tables in the EDM, if “Update Model from Database” refreshes the CSDL, our manual modification of the EDM will be lost.
So please verify that whether the SSDL section is updated after “Update Model from Database”. If it is not, there could be some potential issues.
Have a nice day!
Best Regards,
Lingzhi SunMSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Proposed as answer by David DeWinter - MSFTEditor Monday, May 10, 2010 2:58 PM
- Marked as answer by Michael Sun [MSFT]Microsoft employee Monday, May 17, 2010 1:49 AM
Monday, May 10, 2010 2:29 AM -
Hi RMD,
I am writing to check the status of the issue on your side. Would you mind letting me know the result of the suggestions?
If you need further assistance, please feel free to let me know. I will be more than happy to be of assistance.
Have a nice day!
Best Regards,
Lingzhi SunMSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.Thursday, May 13, 2010 1:26 AM -
I have used EF for about a month. I must say that having "Update Model from Database" work as you have designed it (only updating the SSDL section) makes it unusable. The idea is to make this easy, I don't even know what gets stored in SSDL vs. CSDL and I don't see why I should care. I don't care when I generate .edmx from a database, it just works. I want the same behavior from Update. Or at least have an "Update Model from Database As If It Were From A New Database" option....
Thank you,
DavidSunday, June 27, 2010 10:57 PM -
Or at least have an "Update Model from Database As If It Were From A New Database" option....
Thank you,
David
Submitted https://connect.microsoft.com/data/feedback/details/571934/update-model-from-database-should-update-everythingWednesday, June 30, 2010 4:06 PM -
I have used EF for about a month. I must say that having "Update Model from Database" work as you have designed it (only updating the SSDL section) makes it unusable. The idea is to make this easy, I don't even know what gets stored in SSDL vs. CSDL and I don't see why I should care. I don't care when I generate .edmx from a database, it just works. I want the same behavior from Update. Or at least have an "Update Model from Database As If It Were From A New Database" option....
Thank you,
David
Hi David,I have a third party workaround for this - a "model comparer" for EFv4 that shows a more detailed breakdown of differences between the database, SSDL, and CSDL and allows you to select what diffs you want to bring over.
A brief intro video showing what it does:
http://huagati.blogspot.com/2010/07/introducing-model-comparer-for-entity.html
...and if you want to try it out you can download the add-in from http://www.huagati.com/dbmltools/Best regards,Kristofer
Kristofer - Huagati Systems Co., Ltd.
Cool tools for Linq-to-SQL and Entity Framework:
huagati.com/dbmltools - add-in with new useful features for the L2S and EF designers in VS2008 and VS2010
huagati.com/L2SProfiler - Query profiler for Linq-to-SQL, Entity Framework v4, and LLBLGen Pro- Edited by KristoferA Saturday, May 17, 2014 6:44 AM
Saturday, July 31, 2010 5:13 AM