public ResourceGraphNode( object obj, ApiResource resource, ResourceGraphPathSet includePaths, int graphDepth, string propertyName = null) { obj.ThrowIfNull(nameof(obj)); resource.ThrowIfNull(nameof(resource)); includePaths.ThrowIfNull(nameof(includePaths)); Key = new ResourceGraphNodeKey(obj, resource); SourceObject = obj; IncludePaths = includePaths; PropertyName = propertyName; Resource = resource; GraphDepth = graphDepth; Relationships = Resource.Relationships .Select(r => new { key = r.Name, value = new ResourceGraphRelationship(r, includePaths.MatchesProperty(r.PropertyName), SourceObject.GetValueOfProperty(r.PropertyName)) }).ToDictionary(a => a.key, a => a.value); }
public ResourceGraph( object obj, ApiResource resource, ResourceGraphPathSet includePaths) { obj.ThrowIfNull(nameof(obj)); resource.ThrowIfNull(nameof(resource)); includePaths.ThrowIfNull(nameof(includePaths)); _nodes = new Dictionary <ResourceGraphNodeKey, ResourceGraphNode>(); Build(obj, resource, includePaths, 0); }