开发者

DataContext.Refresh not refreshing the object

开发者 https://www.devze.com 2023-01-17 22:50 出处:网络
I have a datacontext where I after communicating with the database performs the following operation: private DAL.Client _clie开发者_如何学运维nt;

I have a datacontext where I after communicating with the database performs the following operation:

private DAL.Client _clie开发者_如何学运维nt;
public void ReloadCurrentClient()
        {
            DBContext.Refresh(RefreshMode.OverwriteCurrentValues, _client);
        }

I expected this method to bring the client-object back to sync with the database, but for some reason _client.Relationship (which is a collection of relationships) is not updated. Can you please give me some input on where I am off track here?


public void ReloadCurrentClient()
        {
            DBContext.Refresh(RefreshMode.OverwriteCurrentValues,DBContext.Clients );

        }

try this 2nd parameter is object entity.I think DBContext is your Data Context Object & Client is your table name.When you write DAL & press . after that you will see it automatically add 's' into your table name.so use like DBContext.Clients. I hope it works for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消