当前位置: 首页>>代码示例>>C#>>正文


C# IAppBuilder.GetStandardHttpConfig方法代码示例

本文整理汇总了C#中IAppBuilder.GetStandardHttpConfig方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.GetStandardHttpConfig方法的具体用法?C# IAppBuilder.GetStandardHttpConfig怎么用?C# IAppBuilder.GetStandardHttpConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAppBuilder的用法示例。


在下文中一共展示了IAppBuilder.GetStandardHttpConfig方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configuration

        private static void Configuration(IAppBuilder appBuilder, Type targetController)
        {
            var config = appBuilder.GetStandardHttpConfig(targetController);

            config.MapODataServiceRoute("odata", "odata", ODataModels.GetModel());

            config.EnsureInitialized();
        }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:8,代码来源:ContainmentTests.cs

示例2: Configuration

        private static void Configuration(IAppBuilder appBuilder, Type targetController)
        {
            var config = appBuilder.GetStandardHttpConfig(targetController);

            // Define a route to a controller class that contains functions
            config.MapODataServiceRoute("ODataRoute", "odata", GetEdmModel());

            config.EnsureInitialized();
        }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:9,代码来源:DecimalParameterAndResponseTests.cs

示例3: Configuration

        private static void Configuration(IAppBuilder appBuilder, Type targetController)
        {
            var config = appBuilder.GetStandardHttpConfig(targetController);

            // Define a default non- versioned route(default route should be at the end as a last catch-all)
            config.MapODataServiceRoute("DefaultODataRoute", "odata", GetDefaultModel());

            config.EnsureInitialized();
        }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:9,代码来源:PatchTests.cs

示例4: Configuration

        private static void Configuration(IAppBuilder appBuilder, Type targetController, Action<ODataSwaggerDocsConfig> odataSwaggerDocsConfig = null)
        {
            var config = appBuilder.GetStandardHttpConfig(null, odataSwaggerDocsConfig, targetController);

            WebApiConfig.Register(config);

            config.MapODataServiceRoute("DefaultODataRoute", "odata", GetDefaultModel());

            config.EnsureInitialized();
        }
开发者ID:jondavis-ineight,项目名称:Swashbuckle.OData,代码行数:10,代码来源:SchemaTests.cs

示例5: Configuration

        private static void Configuration(IAppBuilder appBuilder, Type targetController)
        {
            var config = appBuilder.GetStandardHttpConfig(targetController);

            var controllerSelector = new UnitTestODataVersionControllerSelector(config, targetController);
            config.Services.Replace(typeof(IHttpControllerSelector), controllerSelector);

            // Define a route to a controller class that contains functions
            config.MapODataServiceRoute("FunctionsODataRoute", "odata/v1", GetFunctionsEdmModel());
            controllerSelector.RouteVersionSuffixMapping.Add("FunctionsODataRoute", "V1");

            config.EnsureInitialized();
        }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:13,代码来源:StringTypeUrlParamTests.cs

示例6: Configuration

        public static void Configuration(IAppBuilder appBuilder, Type targetController)
        {
            var config = appBuilder.GetStandardHttpConfig(targetController);

            var edmModel = GetEdmModel();

            // See http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-routing-conventions
            // Create the default collection of built-in conventions.
            var conventions = ODataRoutingConventions.CreateDefault();
            // Insert the custom convention at the start of the collection.
            conventions.Insert(0, new MyAttributeRoutingConvention(edmModel, config));

            config.MapODataServiceRoute("ODataRoute", "odata", edmModel, new DefaultODataPathHandler(), conventions);

            config.EnsureInitialized();
        }
开发者ID:jondavis-ineight,项目名称:Swashbuckle.OData,代码行数:16,代码来源:CustomRoutingConventionTests.cs

示例7: Configuration

        private static void Configuration(IAppBuilder appBuilder, Type targetController)
        {
            var config = appBuilder.GetStandardHttpConfig(targetController);

            // Define a custom route with custom routing conventions
            var conventions = ODataRoutingConventions.CreateDefault();
            conventions.Insert(0, new CustomNavigationPropertyRoutingConvention());
            var customODataRoute = config.MapODataServiceRoute("CustomODataRoute", "odata", GetCustomRouteModel(), batchHandler: null, pathHandler: new DefaultODataPathHandler(), routingConventions: conventions);
            config.AddCustomSwaggerRoute(customODataRoute, "/Customers({Id})/Orders")
                .Operation(HttpMethod.Post)
                .PathParameter<int>("Id")
                .BodyParameter<Order>("order");

            config.AddCustomSwaggerRoute(customODataRoute, "/Customers({Id})/Orders({orderID})")
                .Operation(HttpMethod.Delete)
                .PathParameter<int>("Id")
                .PathParameter<Guid>("orderID");

            config.EnsureInitialized();
        }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:20,代码来源:CustomSwaggerRouteTests.cs

示例8: Configuration

        private static void Configuration(IAppBuilder appBuilder, Type targetController, Action<HttpConfiguration> configAction)
        {
            var config = appBuilder.GetStandardHttpConfig(targetController);

            configAction(config);

            config.EnsureInitialized();
        }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:8,代码来源:ParameterizedRoutePrefixTests.cs

示例9: Configuration

        private static void Configuration(IAppBuilder appBuilder, Type targetController, Action<HttpConfiguration> configAction)
        {
            var config = appBuilder.GetStandardHttpConfig(targetController);

            var controllerSelector = new UnitTestODataVersionControllerSelector(config, targetController);
            config.Services.Replace(typeof(IHttpControllerSelector), controllerSelector);

            configAction(config);

            controllerSelector.RouteVersionSuffixMapping.Add("FunctionsODataRoute", "V1");

            config.EnsureInitialized();
        }
开发者ID:rbeauchamp,项目名称:Swashbuckle.OData,代码行数:13,代码来源:FunctionTests.cs

示例10: Configuration

        private static void Configuration(IAppBuilder appBuilder, Type targetController = null, Action<SwaggerDocsConfig> swaggerDocsConfig = null)
        {
            var config = appBuilder.GetStandardHttpConfig(swaggerDocsConfig, null, targetController);

            var controllerSelector = new UnitTestODataVersionControllerSelector(config, targetController);
            config.Services.Replace(typeof(IHttpControllerSelector), controllerSelector);

            WebApiConfig.Register(config);

            // Define a versioned route
            config.MapODataServiceRoute("V1RouteVersioning", "odata/v1", GetVersionedModel());
            controllerSelector.RouteVersionSuffixMapping.Add("V1RouteVersioning", "V1");

            // Define a versioned route that doesn't map to any controller
            config.MapODataServiceRoute("odata/v2", "odata/v2", GetFakeModel());
            controllerSelector.RouteVersionSuffixMapping.Add("odata/v2", "V2");

            // Define a default non- versioned route(default route should be at the end as a last catch-all)
            config.MapODataServiceRoute("DefaultODataRoute", "odata", GetDefaultModel());

            config.EnsureInitialized();
        }
开发者ID:jondavis-ineight,项目名称:Swashbuckle.OData,代码行数:22,代码来源:ODataSwaggerProviderTests.cs

示例11: ConfigurationCompositeKey

        private static void ConfigurationCompositeKey(IAppBuilder appBuilder, bool isEnumPrefixFree)
        {
            var config = appBuilder.GetStandardHttpConfig(typeof(ProductWithCompositeEnumIntKeysTestController));

            const string routeName = "CompositeKeyODataRoute";
            var model = GetProductWithCompositeEnumIntKeyModel();
            var routingConventions = (IEnumerable<IODataRoutingConvention>)ODataRoutingConventions.CreateDefaultWithAttributeRouting(routeName, config);
            var uriResolver = isEnumPrefixFree ? new StringAsEnumResolver() : new ODataUriResolver();
            config.MapODataServiceRoute(routeName,
                                        ODataRoutePrefix,
                                        builder => builder
                                            .AddService(ServiceLifetime.Singleton, sp => model)
                                            .AddService(ServiceLifetime.Singleton, sp => routingConventions)
                                            .AddService(ServiceLifetime.Singleton, sp => uriResolver));

            config.EnsureInitialized();
        }
开发者ID:rbeauchamp,项目名称:Swashbuckle.OData,代码行数:17,代码来源:ParameterKeyTests.cs


注:本文中的IAppBuilder.GetStandardHttpConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。