How to refresh the context? ASP.NET

Asked

Viewed 87 times

3

I’m starting to develop in ASP.NET and always have a small problem.

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

inserir a descrição da imagem aqui

I do the following procedure: 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 with the bank and Gero all entities based on my bank...

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

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

1 answer

2

In your case, you’re using the Database First, which is to generate the model according to the tables in your database.

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

  1. Right click on your file .edmx and go on Update Model from Database.;
  2. Just follow the normal steps and ready, but remember that some things may not update, this due to N factors.

Microsoft explains this in this article and in this other.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.