public void Update(DbContext context, ENTITY entity) { foreach (var info in _infos) { if (ExternalLibraryBoundary.IsThisAnEntityObject(info.ValueToSet)) { if (info.SaveFunc != null) { info.SaveFunc(context); } } info.Property.SetValue(entity, info.ValueToSet, null); } }
public virtual void Compare(object entity, Action <string> onFail) { var entityValue = Property.GetValue(entity, null); if (ExternalLibraryBoundary.IsThisAnEntityObject(ValueToCompare)) { if (ExternalLibraryBoundary.AreTheseTheSameEntity(ValueToCompare, entityValue)) { onFail(String.Format("References for property {0} do not match.\n Expected ID {1}\n got {2}", Property.Name, ExternalLibraryBoundary.GetValueOfId(ValueToCompare), ExternalLibraryBoundary.GetValueOfId(entityValue))); } } else if (!ValueToCompare.Equals(entityValue)) { onFail(String.Format("Values for property {0} did not match. {1} != {2}", Property.Name, ValueToCompare, entityValue)); } }