none
How to Refresh the contens in DataContext class in entity framework 7 RRS feed

  • Question

  • Hi,

    I am using entity framework 7 beta version. Making calls to Database context through webapi.

    if any data in the database is changed manually in Database, I have restart webapi to get that latest data. And Also if I update the content of the data in one machine, I have to restart my database context in another machine to get the latest data. Please help me in this.

    1. Whenever data in database is manually changed do we need to restart webapi to refresh the database context?

    2. Is there any way to refresh the content in entity framework 7. I saw we have entry(object).reload() methods in entity framework 6 but not in 7. Please suggest.

    Thanks,

    Ramya.

    Thursday, February 4, 2016 7:57 AM

Answers

  • Hi Ramya,

    >> Whenever data in database is manually changed do we need to restart webapi to refresh the database context? Is there any way to refresh the content in entity framework 7. I saw we have entry(object).reload() methods in entity framework 6 but not in 7. Please suggest.

    Yes, ef7 have removed reload method, I search related web sites about the issue, someone solved the issue by creating short-lived contexts, you could refer to the link as below for more information.

    https://github.com/aspnet/EntityFramework/issues/2280

    Please try it and let me know your result.

    Best regards,

    Cole Wu

    Thursday, February 4, 2016 9:52 AM
    Moderator