T IDebuggable.GetDebugInfo <T>(int parentDepth, int childDepth) { var debug = new DebugDataScopeRules { Instance = this, Name = "data scope rules for " + ElementName, }; lock (_lock) { debug.Scopes = DataScopes .Select(s => new DebugDataScope { DataType = s.DataType, ScopeName = s.ScopeName }) .ToList(); debug.DataSupplies = SuppliedDependencies .Select(suppliedDependency => new DebugSuppliedDependency { Supplier = suppliedDependency.Item1.GetDebugInfo <DebugDataSupplier>(), DataTypeSupplied = suppliedDependency.Item2 == null ? null : new DebugDataScope { DataType = suppliedDependency.Item2.DataType, ScopeName = suppliedDependency.Item2.ScopeName } }) .ToList(); } return(debug as T); }
public void AddSupplier( IDataSupplier supplier, IDataDependency dependencyToSupply) { if (supplier == null) { throw new ArgumentNullException("supplier"); } if (dependencyToSupply == null) { throw new ArgumentNullException("dependencyToSupply"); } lock (_lock) { var suppliedDependency = SuppliedDependencies .FirstOrDefault(d => d.Item1 == supplier && d.Item2.Equals(dependencyToSupply)); if (suppliedDependency != null) { return; } SuppliedDependencies.Add(new Tuple <IDataSupplier, IDataDependency>(supplier, dependencyToSupply)); } }