Adding/Renaming column Entity Framework

Hi ,

I have used entity framework in my application & used Database first approach. I added/renamed some database fields and trying to update my entity model. Here is my database table

Id int PK
Name varchar(50)

Modified To

AccountId int PK
AccountName varchar(50)
AccountDesc varchar(255)

When I update entity data model using "Update Model from Database", In designer I see new fields but "id" and "Name" column still shows in Entity designer like this.


Also I am getting few errors. Can you help me how to resolve this?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The EF designer doesn't automatically remove columns.  I'm guessing the errors you have are something along the lines of "Column 'Name' isn't mapped"?

You can just manually delete them.  Open the designer, click on "Id", and press delete (for the other as well) and rebuild.  That should fix it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
r_pat72Author Commented:
Thank you so much. Also one quick question. I renamed couple of tables in the database. Do I add them as new and remove old tables from entity designer?
Yes, that's usually the by far the easiest / fastest way to go about it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.