コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VersionedODataModelBuilder"/> class.
        /// </summary>
        /// <param name="actionDescriptorCollectionProvider">The <see cref="IActionDescriptorCollectionProvider "/> used to discover OData routes.</param>
        /// <param name="options">The <see cref="ApiVersioningOptions">options</see> associated with the action selector.</param>
        /// <param name="modelConfigurations">The <see cref="IEnumerable{T}">sequence</see> of
        /// <see cref="IModelConfiguration">model configurations</see> associated with the model builder.</param>
        public VersionedODataModelBuilder(
            IActionDescriptorCollectionProvider actionDescriptorCollectionProvider,
            IOptions <ApiVersioningOptions> options,
            IEnumerable <IModelConfiguration> modelConfigurations)
        {
            Arg.NotNull(actionDescriptorCollectionProvider, nameof(actionDescriptorCollectionProvider));
            Arg.NotNull(options, nameof(options));
            Arg.NotNull(modelConfigurations, nameof(modelConfigurations));

            ActionDescriptorCollectionProvider = actionDescriptorCollectionProvider;
            this.options = options;

            foreach (var configuration in modelConfigurations)
            {
                ModelConfigurations.Add(configuration);
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VersionedODataModelBuilder"/> class.
        /// </summary>
        /// <param name="actionDescriptorCollectionProvider">The <see cref="IActionDescriptorCollectionProvider "/> used to discover OData routes.</param>
        /// <param name="options">The <see cref="ApiVersioningOptions">options</see> associated with the action selector.</param>
        /// <param name="modelConfigurations">The <see cref="IEnumerable{T}">sequence</see> of
        /// <see cref="IModelConfiguration">model configurations</see> associated with the model builder.</param>
        public VersionedODataModelBuilder(
            IActionDescriptorCollectionProvider actionDescriptorCollectionProvider,
            IOptions <ApiVersioningOptions> options,
            IEnumerable <IModelConfiguration> modelConfigurations)
        {
            if (modelConfigurations == null)
            {
                throw new ArgumentNullException(nameof(modelConfigurations));
            }

            ActionDescriptorCollectionProvider = actionDescriptorCollectionProvider;
            this.options = options;

            foreach (var configuration in modelConfigurations)
            {
                ModelConfigurations.Add(configuration);
            }
        }
コード例 #3
0
 internal void Register(ModelConfiguration config)
 {
     ModelConfigurations.Add(config);
 }