private IObjectGraphVisitor CreateEmittingVisitor(Emitter emitter, SerializationOptions options, IObjectGraphTraversalStrategy traversalStrategy, IEventEmitter eventEmitter, object graph, Type type) { IObjectGraphVisitor emittingVisitor = new EmittingObjectGraphVisitor(eventEmitter); emittingVisitor = new CustomSerializationObjectGraphVisitor(emitter, emittingVisitor, converters); if ((options & SerializationOptions.DisableAliases) == 0) { var anchorAssigner = new AnchorAssigner(); traversalStrategy.Traverse(graph, type, anchorAssigner); emittingVisitor = new AnchorAssigningObjectGraphVisitor(emittingVisitor, eventEmitter, anchorAssigner); } if ((options & SerializationOptions.EmitDefaults) == 0) { emittingVisitor = new DefaultExclusiveObjectGraphVisitor(emittingVisitor); } return(emittingVisitor); }
private IObjectGraphVisitor CreateEmittingVisitor(Emitter emitter, SerializationOptions options, IObjectGraphTraversalStrategy traversalStrategy, IEventEmitter eventEmitter, object graph, Type type) { IObjectGraphVisitor emittingVisitor = new EmittingObjectGraphVisitor(eventEmitter); emittingVisitor = new CustomSerializationObjectGraphVisitor(emitter, emittingVisitor, converters); if ((options & SerializationOptions.DisableAliases) == 0) { var anchorAssigner = new AnchorAssigner(); traversalStrategy.Traverse(graph, type, anchorAssigner); emittingVisitor = new AnchorAssigningObjectGraphVisitor(emittingVisitor, eventEmitter, anchorAssigner); } if ((options & SerializationOptions.EmitDefaults) == 0) { emittingVisitor = new DefaultExclusiveObjectGraphVisitor(emittingVisitor); } return emittingVisitor; }