femseks
femseks

Reputation: 2964

DataContext.Refresh not refreshing the object

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

private DAL.Client _client;
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?

Upvotes: 3

Views: 4051

Answers (1)

PrateekSaluja
PrateekSaluja

Reputation: 14936

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.

Upvotes: 1

Related Questions