locked
EntityFramework refresh didn't update the Table properly RRS feed

  • Question

  • Hi Team,

    I'm facing issue while refreshing Tables and Views in EntityFramework-6 and the following are issues,

    1. The Removed fields in the table are not properly deleted in the Edmx (EF)

    2. The Field Name changes in the table are not properly updated in the Edmx

    3. New Fields are added at the bottom.. how to change the sequence

    4. when we delete a table then all the class files created under .tt file is getting deleted byitself.

    Please let me how to refresh the Entity Framework properly without the above issues ? 

    Currently, I'm deleting all the entities in the model and re-adding it again. 

    Thanks,

    Prakash.

    Thursday, February 11, 2016 7:09 AM

Answers

  • Hi ps_prakash02,

    According to your description, it seems that you use database first approach with existing database, does it?

    >>The Removed fields in the table are not properly deleted in the Edmx (EF).  The Field Name changes in the table are not properly updated in the Edmx

    Any manual changes to the database can be migrated to the model by Update model from database option. right click on the model, select refresh option, select what table you want to refresh, click button finish.

    >> New Fields are added at the bottom, how to change the sequence  

    By default, new fields are added at the bottom, we couldn’t change the sequence on the model. But this does not affect the business logic. Of course, you could delete the model and add it again would be change the sequence.

    >> when we delete a table then all the class files created under .tt file is getting deleted byitself.

    Do you want to keep the file? You could right click on the model, select Update model from database option, select delete option, select table what you want to delete.

    Best regards,

    Cole Wu



    Friday, February 12, 2016 4:38 AM
  • You should see "Update Model from Database..." when you right click the edmx file.

    chanmm


    chanmm

    Thursday, February 18, 2016 11:09 AM

All replies

  • Hi ps_prakash02,

    According to your description, it seems that you use database first approach with existing database, does it?

    >>The Removed fields in the table are not properly deleted in the Edmx (EF).  The Field Name changes in the table are not properly updated in the Edmx

    Any manual changes to the database can be migrated to the model by Update model from database option. right click on the model, select refresh option, select what table you want to refresh, click button finish.

    >> New Fields are added at the bottom, how to change the sequence  

    By default, new fields are added at the bottom, we couldn’t change the sequence on the model. But this does not affect the business logic. Of course, you could delete the model and add it again would be change the sequence.

    >> when we delete a table then all the class files created under .tt file is getting deleted byitself.

    Do you want to keep the file? You could right click on the model, select Update model from database option, select delete option, select table what you want to delete.

    Best regards,

    Cole Wu



    Friday, February 12, 2016 4:38 AM
  • You should see "Update Model from Database..." when you right click the edmx file.

    chanmm


    chanmm

    Thursday, February 18, 2016 11:09 AM