简体   繁体   中英

How to quickly refresh ADO.NET Entity Data Model?

I am using ADO.NET Entity Data Model in my C# project. There is an ADO.NET Entity Data Model that is generated on the DB in my project. How do I quickly refresh the ADO.NET Entity Data Model based on DB changes? I have been deleting the model and then creating a new one. I believe that there is a more simple and quick way.

Right-click on the model designer and choose "Update Model from Database", and a dialog box will pop up. Click OK and your model will be refreshed.

FYI, I'm using EF 4.0, and I skipped the earlier version, so I can't tell you what it's like in VS 2008.

Update Model from Database doesn't work very well. At least in VS 2008/C# 3.5. I fails to remove old columns, etc.

I always Ctrl-A (to select everything), the press delete, and then create model from database from scratch - update just doesn't work right in a lot of cases. At least in EF4 / VS2010 that I am developing in/with.

右键单击 - 从数据库更新模型。

You should open your Model.edmx after that right click on the properties. now select the (Update Model from Database) and it will going to show you another panel with tab panel. you can choose Add,Refresh and delete. in your current situation, you should select Refresh. then select Tables->dbo->and name of your table in database and then click finish. that's it. you've refresh your table.

but sometimes you can see in your model that something went wrong because the column is not in right position. to solve that just right click the column name and select 'UP' to move it up or 'DOWN' to bring it down.

i hope that it will help.

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