private void TopologicalDerive(DerivationBase derivation, DerivationNodeBase root) { if (this.visited) { if (root.Equals(this.currentRoot)) { this.OnCycle(root.derivable, this.derivable); throw new Exception("This derivation has a cycle. (" + this.currentRoot + " -> " + this + ")"); } return; } this.visited = true; this.currentRoot = root; if (this.dependencies != null) { foreach (var dependency in this.dependencies) { dependency.TopologicalDerive(derivation, root); } } if (!this.derivable.Strategy.IsDeleted) { this.OnDeriving(this.derivable); this.derivable.OnDerive(x => x.WithDerivation(derivation)); this.OnDerived(this.derivable); this.OnPostDeriving(this.derivable); this.derivable.OnPostDerive(x => x.WithDerivation(derivation)); this.OnPostDerived(this.derivable); } derivation.AddDerivedObject(this.derivable); this.currentRoot = null; }
protected abstract DerivationGraphBase CreateDerivationGraph(DerivationBase derivation);
public void TopologicalDerive(DerivationBase derivation) { this.TopologicalDerive(derivation, this); }
protected DerivationGraphBase(DerivationBase derivation) { this.derivation = derivation; this.DerivationNodeByDerivable = new Dictionary <Object, DerivationNodeBase>(); }