public static List <string> GetChangedProperties <T>(this Web.OData.Delta <T> value, T original, List <String> includeList = null) where T : class, new() { if (value == null) { throw new ArgumentNullException("value"); } if (original == null) { throw new ArgumentNullException("original"); } var changedProperties = value.GetChangedPropertyNames(); if (!changedProperties.Any()) { return(new List <string>()); } var compareObjects = new CompareObjects { MaxDifferences = 100, ElementsToInclude = includeList ?? value.GetChangedPropertyNames().ToList() }; compareObjects.ElementsToInclude.Add(typeof(T).Name); bool result = compareObjects.Compare(original, value.GetEntity()); return(!result?compareObjects.Differences.Select(d => d.PropertyName).Distinct().ToList() : new List <string>()); }
protected override bool CanUpdateEntity(TModel original, Web.OData.Delta <TModel> value) { if (value.ContainsChangedProperty(t => t.Id) && !String.Equals(original.Id, value.GetEntity().Id, StringComparison.OrdinalIgnoreCase)) { return(false); } return(base.CanUpdateEntity(original, value)); }