public virtual void InvalidateProperty(object obj, IPropertyMap propertyMap, bool invalidateDirty) { if (propertyMap.IsIdentity) { throw new NPersistException("Identity properties can not be invalidated! Property: " + AssemblyManager.GetBaseType(obj).Name + "." + propertyMap.Name, obj, propertyMap.Name); } IObjectManager om = this.Context.ObjectManager; IPersistenceEngine pe = this.Context.PersistenceEngine; PropertyStatus propStatus; propStatus = om.GetPropertyStatus(obj, propertyMap.Name); if (!(propStatus == PropertyStatus.Dirty && invalidateDirty == false)) { RemoveOriginalValues(obj, propertyMap.Name); } }
protected virtual KeyStruct GetKey(Type type, object identity) { Type fixedType = AssemblyManager.GetBaseType(type); return(new KeyStruct(GetKeyParts(fixedType, identity))); }
public virtual void SetPropertyValue(bool ensureReadConsistency, object obj, string propertyName, object value) { if (ensureReadConsistency) { EnsureReadConsistency(obj, propertyName); } this.Context.ObjectCloner.EnsureIsClonedIfEditing(obj); try { SetPropertyValue(obj, obj.GetType(), propertyName, value); } catch (Exception x) { string message = string.Format("Failed to set property {0} to value {1} on object {2}.{3}", propertyName, value == null ? "null" : value, AssemblyManager.GetBaseType(obj).Name, GetObjectKeyOrIdentity(obj)); throw new LoadException(message, x, obj); } }