Esempio n. 1
0
        /// <summary>
        /// Copies input <paramref name="context"/> with possible changes.
        /// </summary>
        /// <param name="context">Source parser context.</param>
        /// <param name="parserSettings">Optional parser settings.</param>
        /// <param name="schema">Optional schema.</param>
        /// <param name="messages">Optional message list.</param>
        /// <param name="parsersCache">Optional parsers cache.</param>
        /// <param name="schemaCache">Optional schemas cache.</param>
        /// <param name="validatorsCache">Optional validators cache.</param>
        /// <returns>New <see cref="IXmlParserContext"/> instance.</returns>
        public static IXmlParserContext With(
            this IXmlParserContext context,
            IXmlParserSettings?parserSettings      = null,
            Schema.IMutableObjectSchema?schema     = null,
            IMutableMessageList <Message>?messages = null,
            ConcurrentDictionary <IProperty, IValueParser>?parsersCache = null,
            ConcurrentDictionary <IProperty, ISchema>?schemaCache       = null,
            ConcurrentDictionary <IProperty, IPropertyValidationRules>?validatorsCache = null)
        {
            context.AssertArgumentNotNull(nameof(context));

            return(new XmlParserContext(
                       parserSettings: parserSettings ?? context.ParserSettings,
                       schema: schema ?? context.Schema,
                       messages: messages ?? context.Messages,
                       parsersCache: parsersCache ?? context.ParsersCache,
                       schemaCache: schemaCache ?? context.SchemaCache,
                       validatorsCache: validatorsCache ?? context.ValidatorsCache));
        }