// Add this attribute to any movies that don't yet have it. public override void AfterCommit() { base.AfterCommit(); List <DatabaseTable> dbObjs = DBManager.Get(Table, null); foreach (DatabaseTable currObj in dbObjs) { IAttributeOwner currOwner = (IAttributeOwner)currObj; bool needsThisAttr = true; foreach (DBAttribute currAttr in currOwner.Attributes) { if (currAttr.Description != null && currAttr.Description.ID == this.ID) { needsThisAttr = false; break; } } if (needsThisAttr) { DBAttribute newAttr = new DBAttribute(); newAttr.Description = this; currOwner.Attributes.Add(newAttr); currOwner.Attributes.Commit(); } } }
// Add this attribute to any movies that don't yet have it. public override void AfterCommit() { base.AfterCommit(); List<DatabaseTable> dbObjs = DBManager.Get(Table, null); foreach (DatabaseTable currObj in dbObjs) { IAttributeOwner currOwner = (IAttributeOwner)currObj; bool needsThisAttr = true; foreach (DBAttribute currAttr in currOwner.Attributes) if (currAttr.Description != null && currAttr.Description.ID == this.ID) { needsThisAttr = false; break; } if (needsThisAttr) { DBAttribute newAttr = new DBAttribute(); newAttr.Description = this; currOwner.Attributes.Add(newAttr); currOwner.Attributes.Commit(); } } }