简体   繁体   中英

ADO.NET Entity Data Model refresh after incremental Db changes

I am using VS 2013 Express for Web with ADO.NET Entity Data Model.

When updating the entity data model from database using 'refresh' tab option (seems you can only select one item though the heading says select objects plural) the usage seems unclear and I have noticed some issues.

Just two examples:

  1. I changed a stored procedure so it returned the same number of fields but one field was of a slightly different type but the complex type never changed. I realise there can be an impact on client code but this simply did not change the complex type, everything stayed the same. However, removing the relevant elements from the model browser then readding the elments from the database back into the model did exactly what I expected.

  2. I made some significant changes to two or three tables, attributes and one relationship but did bot change the table names. Here again refresh had some very odd results, so I simply created a fresh model.

I am planning some more changes first change specifically I am adding a FK relationship that I forgot.

Is there any way to be sure of what is supported and what is not in terms of refresh.

Also I am concerned that if refresh fails and I so delete the two tables with the relationship, what impact will that have on temporarily orphaned tables and their relationships, and if when I regenerate the two tables their connections with the other tables will still work. I guess it depends how the generated code works underneath.

I want to make these kinds of changes but avoid have to recreate the entire model.

Any advice appreciated.

The most guaranteed way of ensuring you always have the latest version is to select all (Ctrl A) delete, and then re-add everything from the model page.

I know it sounds like a pain but it's guaranteed to work as long as you haven't made any changes to the model from within Visual Studio.

The refresh doesn't always work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM