protected void SmartWrites(RecordManager RM, ref bool WriteHandled) { if (!HasID && HasChanges) { throw new EIDObjectWithoutIDException("Can't write object without ID"); // ID = Guid.NewGuid(); // ??? } if (this is ISmartActiveRecord) { bool HasRef = false; foreach (PropType pt in ChangedProperties) { object v = null; if (ValueExists<ITrackChanges>(pt, out v) && (v as ITrackChanges).HasChanges) { InTable table = RM.ActiveRecordInfo(v.GetType(), false); if (table != null) if (table.Write(v, false) > 0) HasRef = true; ClearChanges(pt); } } WriteHandled = !(HasChanges || (HasRef && IsNewObject)); } }