本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例8: Configuration
private static void Configuration(IAppBuilder appBuilder, Type targetController, Action<HttpConfiguration> configAction)
{
var config = appBuilder.GetStandardHttpConfig(targetController);
configAction(config);
config.EnsureInitialized();
}
示例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();
}
示例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();
}
示例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();
}