Beispiel #1
0
        public FutureInstanceVisitor(ObjectCallerBase <T> handler, ObjectVisitorOptions options, IDictionary <string, object> initialValues = null)
        {
            _options   = options?.Clone() ?? ObjectVisitorOptions.Default;
            _handler   = handler ?? throw new ArgumentNullException(nameof(handler));
            SourceType = typeof(T);

            _handler.New();

            GenericHistoricalContext = _options.Repeatable
                ? new HistoricalContext <T>(_options.AlgorithmKind)
                : null;

            _objectOwnInfo      = ObjectOwn.Of <T>();
            _lazyMemberHandler  = MemberHandler.Lazy(_handler, SourceType, _options.LiteMode);
            _correctnessContext = _options.StrictMode
                ? new CorrectnessContext <T>(this, true)
                : null;

            if (initialValues is not null)
            {
                SetValue(initialValues);
            }

            LazyPropertyNodes = RootNode.New(_handler, _options);
        }
        public StaticTypeObjectVisitor(ObjectCallerBase handler, Type targetType, ObjectVisitorOptions options)
        {
            _options = options?.Clone() ?? ObjectVisitorOptions.Default;
            _handler = handler ?? throw new ArgumentNullException(nameof(handler));

            SourceType = targetType ?? throw new ArgumentNullException(nameof(targetType));

            _objectOwnInfo      = ObjectOwn.Of(targetType);
            _lazyMemberHandler  = MemberHandler.Lazy(_handler, SourceType, _options.LiteMode);
            _correctnessContext = _options.StrictMode
                ? new CorrectnessContext(this, true)
                : null;

            LazyPropertyNodes = RootNode.New(_handler, _options.Clone(x => x.Repeatable = RpMode.NON_REPEATABLE));
        }
        public InstanceVisitor(ObjectCallerBase handler, Type sourceType, ObjectVisitorOptions options)
        {
            _options = options?.Clone() ?? ObjectVisitorOptions.Default;
            _handler = handler ?? throw new ArgumentNullException(nameof(handler));

            SourceType = sourceType ?? throw new ArgumentNullException(nameof(sourceType));
            NormalHistoricalContext = _options.Repeatable
                ? new HistoricalContext(sourceType, _options.AlgorithmKind)
                : null;

            _objectOwnInfo      = ObjectOwn.Of(sourceType);
            _lazyMemberHandler  = MemberHandler.Lazy(_handler, SourceType, _options.LiteMode);
            _correctnessContext = _options.StrictMode
                ? new CorrectnessContext(this, true)
                : null;

            LazyPropertyNodes = RootNode.New(_handler, _options);
        }