tags:

views:

45

answers:

1

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?

A: 

Hello ,

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.

PrateekSaluja
Doesnt this mean that its updating ALL clients? This would probably work if you have 100 clients, but not when you have a lot more than that..
femseks
@femseks:It will update a whole table.
PrateekSaluja
Exactly.. That means that this will not be a good solution.. I only need to update the client that I'm currently working with..
femseks