when I added entityfarme work model in mvc Application ..so ultimately it added respected model classes for each table in database .and it added commented line in each class like that

// <auto-generated>

// This code was generated from a template.

//

// Manual changes to this file may cause unexpected behavior in your application.

// Manual changes to this file will be overwritten if the code is regenerated.

// </auto-generated>

Now the problem is if I added another table in database ..and wanted to create respective class in same application ..should I drop .edmx file and recreate EF model so that it cover added table in project ..??

Recommended Answers

All 11 Replies

You just hit update model from database as far as I remember - no need to delete.

I am doing code first now though which is much better but I'm sure that's right.

code first is best when working with test environment ..

Yes code first is definatley best.

but i want to use any other technique..do not want to drop or create db again.and again

You are using database first - we are not telling you to change that. We are just saying that code first is better.

To answer your original question (which I have done already) - just right click on your edmx and click update model from database. Ok?

Based on years of experience and many discusions with other experienced developers both face to face and online and through working in many different companies as a contractor and seeing them both in use.

Database first has it's place of course in certain scenarios but for the most part code first is far superior.

Member Avatar for iamthwee

Database first has it's place of course in certain scenarios but for the most part code first is far superior.

Is this serious suggestion?

Is this serious suggestion?

Am sure it is. I do think it works when starting something from scratch and you are free to do your own database.

Is what a serious suggestion?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.