Refresh entity instance with DbContext

后端 未结 3 2171
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 15:57

With EF4 CTP5 DbContext, what is the equivalent of this

    public void Refresh(Document instance)
    {
        _ctx.Refresh(RefreshMode.StoreWins, instance         


        
3条回答
  •  失恋的感觉
    2020-12-02 16:13

    You must use this:

    public void Refresh(Document instance)
    {
      _ctx.Entry(instance).Reload();
    }
    

提交回复
热议问题