Entity Framework Caching Issue

后端 未结 12 2191
無奈伤痛
無奈伤痛 2020-12-08 00:19

I am new to Entity Framework.

I have get to some values in my database using EF. It returns perfectly, and the values are shown in labels. But When I delete all valu

12条回答
  •  爱一瞬间的悲伤
    2020-12-08 00:44

    Below code helped my object to be refreshed with fresh database values. The Entry(object).Reload() command forces the object to recall database values

    GM_MEMBERS member = DatabaseObjectContext.GM_MEMBERS.FirstOrDefault(p => p.Username == username && p.ApplicationName == this.ApplicationName);
    DatabaseObjectContext.Entry(member).Reload();
    

提交回复
热议问题