How to refresh the context? ASP.NET

3

I'm starting to develop in ASP.NET and I always have a little problem.

When I need to generate a context (that class that will reference with the bank), example below:

I do the following: Botão direito em cima do projeto -> Add -> new item -> data -> ADO.NET Entity Data Model after that I give the name of the class connected to the bank and generate all entities based on my bank ...

When I change or add any field in my database, every time I have to delete this class and create it again, I would like to know if there is a way to give refresh , and it updates with the new fields who are in the bank?

If someone knows this solution, please share it with me, because it will be of great help and great productivity, thank you !!!

    
asked by anonymous 11.06.2016 / 01:15

1 answer

2

In your case, you are using Database First , which is to generate the template according to the tables in your database.

You can update your .edmx normally, just follow these steps:

  • Right-click on your .edmx file and go to Update Model from Database. ;
  • Just follow the normal steps and that's it, but keep in mind that some things may not update because of N factors.
  • Microsoft explains this in this article and in this another .

        
    11.06.2016 / 21:27