locked
How to get original values for IEntityTrackedProperty RRS feed

  • Question

  • Hi,

    I am able to get the original values for native properties of a table, but how can i get the original value for properties releated with another table.

    Here's my code.

     

    Dictionary<string, string> originalValues = new Dictionary<string, string>();       

        foreach (var prop in entity.Details.Properties.All().OfType<IEntityTrackedProperty>())

                {           

        if (prop.OriginalValue != null)           

        {    originalValues.Add(prop.Name.ToString(), prop.OriginalValue.ToString());     

              }     

          }


    Any help on this?

    Friday, June 26, 2015 7:28 AM

Answers

  • For related tables, use IEntityReferenceProperty instead of IEntityTrackedProperty.  You may need to use both if need to get them all.  Or use IEntityReferenceProperty in conjunction with IEntityStorageProperty.
    Friday, June 26, 2015 11:59 PM

All replies

  • Hi,

    I am able to get the original value of native properties of a table, but how can i get the original value for the properties which related to another tables.

     
    Dictionary<string, string> originalValues = new Dictionary<string, string>();            foreach (var prop in entity.Details.Properties.All().OfType<IEntityTrackedProperty>())            {                if (prop.OriginalValue != null)                {                    originalValues.Add(prop.Name.ToString(), prop.OriginalValue.ToString());                }            }

    • Merged by Angie Xu Monday, June 29, 2015 1:51 AM same issue
    Friday, June 26, 2015 7:14 AM
  • For related tables, use IEntityReferenceProperty instead of IEntityTrackedProperty.  You may need to use both if need to get them all.  Or use IEntityReferenceProperty in conjunction with IEntityStorageProperty.
    Friday, June 26, 2015 11:59 PM