locked
Get Original Values within a DataService RRS feed

  • Question

  • I am wanting to find which properties have changed in an entity before committing it.

    So in the _Updating I want to get the (cureent in DB) value for  the entity and compare it to the proposed value.

    I note that we are dealing with an Microsoft.LightSwitch.Framework.EntitySet

    As you are aware System.Data.Linq.EntitySet has this functionality.

    ------

    JES

    Friday, March 15, 2013 6:46 PM

Answers

  • Hi Jack,

    You can access the original value of an entity's property using the details API. For example

            partial void Customers_Updating(Customer entity)
            {
                var newValue = entity.Details.Properties.Name.Value;
                var originalValue = entity.Details.Properties.Name.OriginalValue;
            }

    Section "Working with the save pipeline" in this article will have more details about this.

    Best regards,
    Huy Nguyen

    Friday, March 15, 2013 8:22 PM

All replies

  • Hi Jack,

    You can access the original value of an entity's property using the details API. For example

            partial void Customers_Updating(Customer entity)
            {
                var newValue = entity.Details.Properties.Name.Value;
                var originalValue = entity.Details.Properties.Name.OriginalValue;
            }

    Section "Working with the save pipeline" in this article will have more details about this.

    Best regards,
    Huy Nguyen

    Friday, March 15, 2013 8:22 PM
  • Huy

    u dee man

    Saturday, March 16, 2013 2:21 AM