public override sealed void OnPreUpdate(Net.Vpc.Upa.Callbacks.UpdateEvent @event) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { string name = @event.GetTrigger().GetName(); Net.Vpc.Upa.Persistence.EntityExecutionContext executioncontext = @event.GetContext(); if (AcceptUpdateTableHelper(@event)) { System.Collections.Generic.ICollection <Net.Vpc.Upa.Key> v = CreateUpdatedCollection(@event.GetEntity(), @event.GetFilterExpression()); if (!(v.Count == 0)) { executioncontext.SetObject(name + ":toUpdate", v); } } }
public override void OnPreUpdate(Net.Vpc.Upa.Callbacks.UpdateEvent @event) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext = @event.GetContext(); System.Collections.Generic.IList <Net.Vpc.Upa.Field> updateTreeFields = GetUpdateTreeFields(); Net.Vpc.Upa.Record updates = @event.GetUpdatesRecord(); if (!updates.IsSet(updateTreeFields[0].GetName())) { return; } object val = updates.GetObject <T>(updateTreeFields[0].GetName()); if (val is Net.Vpc.Upa.Expressions.Literal) { val = ((Net.Vpc.Upa.Expressions.Literal)val).GetValue(); } else if (val is Net.Vpc.Upa.Expressions.Expression) { // Log.bug("1232123"); return; } if (val != null) { object parentId = relation.ExtractId(updates); if (parentId != null) { Net.Vpc.Upa.Entity entity = @event.GetEntity(); string k = "recurse"; if (!executionContext.IsSet(k)) { System.Collections.Generic.IList <object> idList = entity.CreateQueryBuilder().ByExpression(@event.GetFilterExpression()).OrderBy(entity.GetUpdateFormulasOrder()).GetIdList <K>(); executionContext.SetObject(k, idList); } System.Collections.Generic.IList <object> r = (System.Collections.Generic.IList <object>)executionContext.GetObject <T>("recurse"); foreach (object aR in r) { if (support.IsEqualOrIsParent(aR, parentId)) { throw new Net.Vpc.Upa.Exceptions.UPAException("RedundancyProblem"); } } } } }