Wednesday, December 2, 2015

Update EDMX from database

In database first approach, you create your database first and then you generate model from database. This creates respective entities in your project.

However any change in database schema, does not reflects automatically in your model. For this you need to update your model. Following are 2 techniques:


  1. Delete and create(not prefered solution): Here you just need to delete entitiy in model browser. And then you just need to right click and click "Generate Model from Database" this regenerate model from database. This is a good solutions for hobby projects or test projects. However this is not recomended.
  2. Update entities from database: Below are the steps to update entities from database:
    1. Right click model(in edmx file).
    2. Click update model from database:
    3. There ate three tabs(Add, Refresh & Delete).
    4. In Refresh tab expend tables > dbo(schema) > and select updated entity.


All done. Now you

No comments:

Post a Comment