public Dependency GetOrAdd(DependencyType type) { if (_dependencies.TryGetValue(type, out var dependency)) { return(dependency); } dependency = new Dependency(this, type); _dependencies.Add(type, dependency); return(dependency); }
/// <summary> /// Initializes a new instance of the <see cref="Dependency"/> class. /// </summary> /// <param name="graph">The graph which this dependency is part of</param> /// <param name="type">The type of this dependency</param> public Dependency(DependencyGraph graph, DependencyType type) { Graph = graph ?? throw new ArgumentNullException(nameof(graph)); Type = type ?? throw new ArgumentNullException(nameof(type)); }
public Dependency GetOrAdd(Type modelType, Type linkedSourceType = null) { var type = new DependencyType(modelType, linkedSourceType); return(GetOrAdd(type)); }