views:

216

answers:

0

Hi,

I use Entity Framework V4 and i want to update Customer who have Visits.

My code :

        EntityKey key;
        object originalItem;

        key = this._modelContainer.CreateEntityKey("Customers", customer);

        if (this._modelContainer.TryGetObjectByKey(key, out originalItem))
        {
            this._modelContainer.ApplyCurrentValues(key.EntitySetName, customer);
        }

        this._modelContainer.SaveChanges();

It works for Scalar Property only. The customers.Visits collection is not updated.

Best Regards :)