/// <summary>
        /// Initializes a new instance of the <see cref="ResourceExplorer"/> class.
        /// </summary>
        /// <param name="options">Configuration optiosn for <see cref="ResourceExplorer"/>.</param>
        public ResourceExplorer(ResourceExplorerOptions options)
        {
            this.options = options ?? throw new ArgumentNullException(nameof(options));

            if (options.Providers != null)
            {
                this.resourceProviders = options.Providers.ToList();
            }

            if (options.DeclarativeTypes != null)
            {
                this.declarativeTypes = options.DeclarativeTypes.ToList();
            }

            if (options.TypeRegistrations != null)
            {
                foreach (var registration in options.TypeRegistrations)
                {
                    RegisterTypeInternal(registration.Kind, registration.Type, registration.CustomDeserializer);
                }
            }

            if (options.ConverterFactories != null)
            {
                this.converterFactories.AddRange(options.ConverterFactories);
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceExplorer"/> class.
        /// </summary>
        /// <param name="options">Configuration optiosn for <see cref="ResourceExplorer"/>.</param>
        public ResourceExplorer(ResourceExplorerOptions options)
        {
            this.options = options ?? throw new ArgumentNullException(nameof(options));

            if (options.Providers != null)
            {
                this.resourceProviders = options.Providers.ToList();
            }

            if (options.DeclarativeTypes != null)
            {
                this.declarativeTypes = options.DeclarativeTypes.ToList();
            }
        }