Reputation: 2001
Assume that I have added a product table into sql server DB. How to generate product class to existing edmx file?
Upvotes: 2
Views: 4736
Reputation: 1126
you have to update your edmx file right click on the screen and Click on Update Model From Database. then a window will come select you table from the tables and follow the wizard. when you finish the wizard then you will find your selected table entity in the edmx and the generated class will b in yourmodel.tt file
then you have to go to the youmodel.context file and make property for the new class like
public DbSet<yourClass> ex { get; set; }
and then you good to go
for ref follow the Link
Upvotes: 3
Reputation: 3314
Whenever you add a new table to you database, you need to update you Edmx. For that simply open you edmx and right click --> select update model form database and select you newly added table and then click finish. Your model will be updated and new classes will be automatically added.
Upvotes: 2