开发者

DataContext.Refresh not refreshing the object

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜