public bool TryCreatePropertyVisitor(Type type, out IReflectionGraphPropertyVisitor visitor) { bool wasAdded; var graph = _graphs.GetOrAdd(type, out wasAdded); visitor = new SerializationReflectionGraphPropertyVisitor(graph); return(true); }
private void TravelRecursive(HashSet <Type> travelledTypes, Type type, IReflectionGraphPropertyVisitor visitor) { var properties = type.GetTypeInfo().GetProperties(PropertyBindings); foreach (var property in properties) { visitor.Visit(property); var childType = property.PropertyType; if (travelledTypes.Contains(childType)) { continue; } travelledTypes.Add(childType); IReflectionGraphPropertyVisitor childVisitor; if (_factory.TryCreatePropertyVisitor(childType, out childVisitor)) { TravelRecursive(travelledTypes, childType, childVisitor); } } }