Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ODataApiDescriptionProvider"/> class.
        /// </summary>
        /// <param name="routeCollectionProvider">The <see cref="IODataRouteCollectionProvider">OData route collection provider</see> associated with the description provider.</param>
        /// <param name="inlineConstraintResolver">The <see cref="IInlineConstraintResolver">inline constraint resolver</see> used to parse route template constraints.</param>
        /// <param name="metadataProvider">The <see cref="IModelMetadataProvider">provider</see> used to retrieve model metadata.</param>
        /// <param name="options">The <see cref="IOptions{TOptions}">container</see> of configured <see cref="ODataApiExplorerOptions">API explorer options</see>.</param>
        /// <param name="mvcOptions">A <see cref="IOptions{TOptions}">holder</see> containing the current <see cref="Mvc.MvcOptions">MVC options</see>.</param>
        public ODataApiDescriptionProvider(
            IODataRouteCollectionProvider routeCollectionProvider,
            IInlineConstraintResolver inlineConstraintResolver,
            IModelMetadataProvider metadataProvider,
            IOptions <ODataApiExplorerOptions> options,
            IOptions <MvcOptions> mvcOptions)
        {
            Arg.NotNull(routeCollectionProvider, nameof(routeCollectionProvider));
            Arg.NotNull(metadataProvider, nameof(metadataProvider));
            Arg.NotNull(options, nameof(options));
            Arg.NotNull(mvcOptions, nameof(mvcOptions));

            RouteCollectionProvider = routeCollectionProvider;
            ModelTypeBuilder        = new DefaultModelTypeBuilder();
            ConstraintResolver      = inlineConstraintResolver;
            MetadataProvider        = metadataProvider;
            this.options            = options;
            MvcOptions    = mvcOptions.Value;
            modelMetadata = new Lazy <ModelMetadata>(NewModelMetadata);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ODataApiDescriptionProvider"/> class.
        /// </summary>
        /// <param name="routeCollectionProvider">The <see cref="IODataRouteCollectionProvider">OData route collection provider</see> associated with the description provider.</param>
        /// <param name="inlineConstraintResolver">The <see cref="IInlineConstraintResolver">inline constraint resolver</see> used to parse route template constraints.</param>
        /// <param name="metadataProvider">The <see cref="IModelMetadataProvider">provider</see> used to retrieve model metadata.</param>
        /// <param name="defaultQuerySettings">The OData <see cref="DefaultQuerySettings">default query setting</see>.</param>
        /// <param name="options">The <see cref="IOptions{TOptions}">container</see> of configured <see cref="ODataApiExplorerOptions">API explorer options</see>.</param>
        /// <param name="mvcOptions">A <see cref="IOptions{TOptions}">holder</see> containing the current <see cref="Mvc.MvcOptions">MVC options</see>.</param>
        public ODataApiDescriptionProvider(
            IODataRouteCollectionProvider routeCollectionProvider,
            IInlineConstraintResolver inlineConstraintResolver,
            IModelMetadataProvider metadataProvider,
            DefaultQuerySettings defaultQuerySettings,
            IOptions <ODataApiExplorerOptions> options,
            IOptions <MvcOptions> mvcOptions)
        {
            if (mvcOptions == null)
            {
                throw new ArgumentNullException(nameof(mvcOptions));
            }

            RouteCollectionProvider = routeCollectionProvider;
            ModelTypeBuilder        = new DefaultModelTypeBuilder();
            ConstraintResolver      = inlineConstraintResolver;
            MetadataProvider        = metadataProvider;
            DefaultQuerySettings    = defaultQuerySettings;
            this.options            = options;
            MvcOptions    = mvcOptions.Value;
            modelMetadata = new Lazy <ModelMetadata>(NewModelMetadata);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ODataApiDescriptionProvider"/> class.
        /// </summary>
        /// <param name="routeCollectionProvider">The <see cref="IODataRouteCollectionProvider">OData route collection provider</see> associated with the description provider.</param>
        /// <param name="partManager">The <see cref="ApplicationPartManager">application part manager</see> containing the configured application parts.</param>
        /// <param name="inlineConstraintResolver">The <see cref="IInlineConstraintResolver">inline constraint resolver</see> used to parse route template constraints.</param>
        /// <param name="metadataProvider">The <see cref="IModelMetadataProvider">provider</see> used to retrieve model metadata.</param>
        /// <param name="options">The <see cref="IOptions{TOptions}">container</see> of configured <see cref="ODataApiExplorerOptions">API explorer options</see>.</param>
        /// <param name="mvcOptions">A <see cref="IOptions{TOptions}">holder</see> containing the current <see cref="Mvc.MvcOptions">MVC options</see>.</param>
        public ODataApiDescriptionProvider(
            IODataRouteCollectionProvider routeCollectionProvider,
            ApplicationPartManager partManager,
            IInlineConstraintResolver inlineConstraintResolver,
            IModelMetadataProvider metadataProvider,
            IOptions <ODataApiExplorerOptions> options,
            IOptions <MvcOptions> mvcOptions)
        {
            Arg.NotNull(routeCollectionProvider, nameof(routeCollectionProvider));
            Arg.NotNull(partManager, nameof(partManager));
            Arg.NotNull(metadataProvider, nameof(metadataProvider));
            Arg.NotNull(options, nameof(options));
            Arg.NotNull(mvcOptions, nameof(mvcOptions));

            RouteCollectionProvider = routeCollectionProvider;
            Assemblies         = partManager.ApplicationParts.OfType <AssemblyPart>().Select(p => p.Assembly).ToArray();
            ModelTypeBuilder   = new DefaultModelTypeBuilder(Assemblies);
            ConstraintResolver = inlineConstraintResolver;
            MetadataProvider   = metadataProvider;
            this.options       = options;
            MvcOptions         = mvcOptions.Value;
            modelMetadata      = new Lazy <ModelMetadata>(NewModelMetadata);
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ODataApiExplorer"/> class.
 /// </summary>
 /// <param name="configuration">The current <see cref="HttpConfiguration">HTTP configuration</see>.</param>
 /// <param name="options">The associated <see cref="ODataApiExplorerOptions">API explorer options</see>.</param>
 public ODataApiExplorer(HttpConfiguration configuration, ODataApiExplorerOptions options) : base(configuration, options)
 {
     Options          = options;
     ModelTypeBuilder = new DefaultModelTypeBuilder(configuration.Services.GetAssembliesResolver().GetAssemblies());
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ODataApiExplorer"/> class.
 /// </summary>
 /// <param name="configuration">The current <see cref="HttpConfiguration">HTTP configuration</see>.</param>
 /// <param name="options">The associated <see cref="ODataApiExplorerOptions">API explorer options</see>.</param>
 public ODataApiExplorer( HttpConfiguration configuration, ODataApiExplorerOptions options ) : base( configuration, options )
 {
     Options = options;
     ModelTypeBuilder = new DefaultModelTypeBuilder();
 }