public static void UpdateConfiguration(HttpConfiguration configuration) { var controllers = new[] { typeof(EmployeesController), typeof(MetadataController) }; TestAssemblyResolver resolver = new TestAssemblyResolver(new TypesInjectionAssembly(controllers)); configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; configuration.Services.Replace(typeof(IAssembliesResolver), resolver); configuration.Routes.Clear(); IEdmModel edmModel = UnBoundFunctionEdmModel.GetEdmModel(); DefaultODataPathHandler pathHandler = new DefaultODataPathHandler(); // only with attribute routing & metadata routing convention IList <IODataRoutingConvention> routingConventions = new List <IODataRoutingConvention> { new AttributeRoutingConvention("AttributeRouting", configuration), new MetadataRoutingConvention() }; configuration.Count().Filter().OrderBy().Expand().MaxTop(null); configuration.MapODataServiceRoute("AttributeRouting", "AttributeRouting", edmModel, pathHandler, routingConventions); // only with convention routing configuration.MapODataServiceRoute("ConventionRouting", "ConventionRouting", edmModel, pathHandler, ODataRoutingConventions.CreateDefault()); configuration.EnsureInitialized(); }
public static void UpdateConfiguration(HttpConfiguration configuration) { configuration.Routes.Clear(); configuration.MapODataServiceRoute("odata", "odata", GetEdmModel(), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); configuration.MessageHandlers.Add(new ETagMessageHandler()); }
protected override void UpdateConfiguration(WebRouteConfiguration config) { config.Routes.Clear(); config.MapODataServiceRoute("odata", "odata", GetModel(config), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); }
public ODataFunctionTests() { DefaultODataPathHandler pathHandler = new DefaultODataPathHandler(); HttpConfiguration configuration = new[] { typeof(MetadataController), typeof(FCustomersController) }.GetHttpConfiguration(); var model = GetUnTypedEdmModel(); // without attribute routing configuration.MapODataServiceRoute("odata1", "odata", model, pathHandler, ODataRoutingConventions.CreateDefault()); // only with attribute routing IList <IODataRoutingConvention> routingConventions = new List <IODataRoutingConvention> { new AttributeRoutingConvention(model, configuration) }; configuration.MapODataServiceRoute("odata2", "attribute", model, pathHandler, routingConventions); _client = new HttpClient(new HttpServer(configuration)); }
protected override void UpdateConfiguration(WebRouteConfiguration configuration) { configuration.Count().Filter().OrderBy().Expand().MaxTop(null).Select(); configuration.MapODataServiceRoute("convention", "convention", GetConventionModel(configuration), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); }
public static void UpdateConfiguration(HttpConfiguration configuration) { configuration.Routes.Clear(); configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; ODataConventionModelBuilder builder = new ODataConventionModelBuilder(); builder.EntitySet <ComplextTypeCollectionTests_Person>("ComplextTypeCollectionTests_Persons"); configuration.Count().Filter().OrderBy().Expand().MaxTop(null); configuration.MapODataServiceRoute("odataRoute", "odata", builder.GetEdmModel(), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); }
public static void UpdateConfiguration(HttpConfiguration config) { config.Routes.Clear(); config.MapODataServiceRoute("convention", "convention", GetConventionModel(), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); config.MapODataServiceRoute("explicit", "explicit", GetExplicitModel(), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); }
private static HttpConfiguration GetQueryOptionConfiguration(bool caseInsensitive) { var config = RoutingConfigurationFactory.CreateWithTypes(new[] { typeof(ParserExtenstionCustomersController) }); ODataUriResolver resolver = new ODataUriResolver(); if (caseInsensitive) { resolver = new CaseInsensitiveResolver(); } config.Count().OrderBy().Filter().Expand().MaxTop(null).Select(); config.MapODataServiceRoute("query", "query", builder => builder.AddService(ServiceLifetime.Singleton, sp => GetEdmModel()) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting("query", config)) .AddService(ServiceLifetime.Singleton, sp => resolver)); return(config); }
public async Task ExtensionResolver_Works_EnumPrefixFree(string parameter, bool enableEnumPrefix, HttpStatusCode statusCode) { // Arrange IEdmModel model = GetEdmModel(); var config = RoutingConfigurationFactory.CreateWithTypes(new[] { typeof(ParserExtenstionCustomersController) }); ODataUriResolver resolver = new ODataUriResolver(); if (enableEnumPrefix) { resolver = new StringAsEnumResolver(); } config.MapODataServiceRoute("odata", "odata", builder => builder.AddService(ServiceLifetime.Singleton, sp => model) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting("odata", config)) .AddService(ServiceLifetime.Singleton, sp => resolver)); HttpClient client = new HttpClient(new HttpServer(config)); // Act HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, String.Format("http://localhost/odata/ParserExtenstionCustomers/Default.GetCustomerByGender({0})", parameter)); HttpResponseMessage response = await client.SendAsync(request); // Assert Assert.Equal(statusCode, response.StatusCode); if (statusCode == HttpStatusCode.OK) { Assert.Equal("GetCustomerByGender/Male", (response.Content as ObjectContent <string>).Value); } }
protected override void UpdateConfiguration(WebRouteConfiguration configuration) { configuration.JsonReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; configuration.Count().Filter().OrderBy().Expand().MaxTop(null).Select(); configuration.MapODataServiceRoute("untyped", "untyped", GetEdmModel(configuration), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); }
private static HttpConfiguration GetConfiguration(bool caseInsensitive, bool unqualifiedNameCall) { IEdmModel model = ODataRoutingModel.GetModel(); HttpConfiguration config = RoutingConfigurationFactory.CreateWithTypes(new[] { typeof(MetadataController), typeof(ProductsController), typeof(RoutingCustomersController), }); ODataUriResolver resolver = new ODataUriResolver(); if (unqualifiedNameCall) { resolver = new UnqualifiedODataUriResolver(); if (caseInsensitive) { resolver = new UnqualifiedCaseInsensitiveResolver(); } } else { if (caseInsensitive) { resolver = new CaseInsensitiveResolver(); } } config.Count().Filter().OrderBy().Expand().MaxTop(null).Select(); config.MapODataServiceRoute("odata", "odata", builder => builder.AddService(ServiceLifetime.Singleton, sp => model) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting("odata", config)) .AddService(ServiceLifetime.Singleton, sp => resolver)); return(config); }
public static void UpdateConfiguration(HttpConfiguration config) { var controllers = new[] { typeof(CustomersController), typeof(OrdersController), typeof(AddressesController) }; TestAssemblyResolver resolver = new TestAssemblyResolver(new TypesInjectionAssembly(controllers)); config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; config.Services.Replace(typeof(IAssembliesResolver), resolver); config.Routes.Clear(); config.MapODataServiceRoute("odata", "", builder => builder.AddService(ServiceLifetime.Singleton, sp => GetModel()) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting("odata", config)) .AddService(ServiceLifetime.Singleton, sp => new CaseInsensitiveResolver())); }
/// <summary> /// Maps the specified OData route. When the <paramref name="batchHandler"/> is provided, it will create a '$batch' endpoint to handle the batch requests. /// </summary> /// <param name="routes">A collection of routes for the application.</param> /// <param name="routeName">The name of the route to map.</param> /// <param name="routePrefix">The prefix to add to the OData route's path template.</param> /// <param name="model">The EDM model to use for parsing OData paths.</param> /// <param name="batchHandler">The <see cref="ODataBatchHandler"/>.</param> public static void MapODataRoute(this HttpRouteCollection routes, string routeName, string routePrefix, IEdmModel model, ODataBatchHandler batchHandler) { routes.MapODataRoute(routeName, routePrefix, model, new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault(), batchHandler); }
protected override void UpdateConfiguration(WebRouteConfiguration configuration) { configuration.AddControllers(typeof(CustomersController), typeof(OrdersController)); configuration.JsonReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; configuration.MapODataServiceRoute("customcountvalidator", "customcountvalidator", builder => builder.AddService(ServiceLifetime.Singleton, sp => EdmModel.GetEdmModel(configuration)) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting("customcountvalidator", configuration)) .AddService <CountQueryValidator, MyCountQueryValidator>(ServiceLifetime.Singleton)); }
public static void Configure(HttpConfiguration httpConfig) { IEdmModel model = StaticModel.BuildModel(); DynamicModel.AddToModel(model); httpConfig.MapODataServiceRoute("odata", "odata", builder => { var odataMessageReaderSettings = new ODataMessageReaderSettings { ReadUntypedAsString = false }; builder .AddServicePrototype(odataMessageReaderSettings) .AddService(ServiceLifetime.Singleton, sp => model) .AddService <IODataPathHandler>(ServiceLifetime.Singleton, sp => new DefaultODataPathHandler()) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefault()); }); httpConfig.Filters.Add(new ActionArgumentValidationAttribute()); }
public async Task ExtensionResolver_Works_EnumPrefixFree_QueryOption(string query, bool enableEnumPrefix, HttpStatusCode statusCode, string output) { // Arrange IEdmModel model = GetEdmModel(); var config = RoutingConfigurationFactory.CreateWithTypes(new[] { typeof(ParserExtenstionCustomersController) }); ODataUriResolver resolver = new ODataUriResolver(); if (enableEnumPrefix) { resolver = new StringAsEnumResolver(); } config.MapODataServiceRoute("odata", "odata", builder => builder.AddService(ServiceLifetime.Singleton, sp => model) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting("odata", config)) .AddService(ServiceLifetime.Singleton, sp => resolver)); HttpClient client = new HttpClient(new HttpServer(config)); // Act HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, String.Format("http://localhost/odata/ParserExtenstionCustomers?{0}", query)); HttpResponseMessage response = await client.SendAsync(request); // Assert Assert.Equal(statusCode, response.StatusCode); if (statusCode == HttpStatusCode.OK) { JObject content = await response.Content.ReadAsAsync <JObject>(); Assert.Equal(output, String.Join(",", content["value"].Select(e => e["Id"]))); } }
protected override void UpdateConfiguration(WebRouteConfiguration configuration) { var conventions = ODataRoutingConventions.CreateDefault(); configuration.MapODataServiceRoute("CustomActionConventions", "CustomActionConventions", GetCustomActionConventionsModel(configuration), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); configuration.AddODataQueryFilter(); }
public static void UpdateConfiguration(HttpConfiguration configuration) { var controllers = new[] { typeof(UmbrellaController), typeof(MonstersIncController), typeof(MetadataController), typeof(PartnersController) }; TestAssemblyResolver resolver = new TestAssemblyResolver(new TypesInjectionAssembly(controllers)); configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; configuration.Services.Replace(typeof(IAssembliesResolver), resolver); configuration.Routes.Clear(); configuration.MapODataServiceRoute("ModelBuilderWithConventionRouting", "expCon", SingletonEdmModel.GetExplicitModel("Umbrella"), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); configuration.MapODataServiceRoute("ModelBuilderWithAttributeRouting", "expAttr", SingletonEdmModel.GetExplicitModel("MonstersInc")); configuration.MapODataServiceRoute("ConventionBuilderwithConventionRouting", "conCon", SingletonEdmModel.GetConventionModel("Umbrella"), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); configuration.MapODataServiceRoute("ConventionBuilderwithAttributeRouting", "conAttr", SingletonEdmModel.GetConventionModel("MonstersInc")); configuration.EnsureInitialized(); }
public virtual void Configure(IAppBuilder owinApp) { if (owinApp == null) { throw new ArgumentNullException(nameof(owinApp)); } _webApiConfig = new HttpConfiguration(); _webApiConfig.SuppressHostPrincipal(); _webApiConfig.SetTimeZoneInfo(TimeZoneInfo.Utc); _webApiConfig.Formatters.Clear(); _webApiConfig.IncludeErrorDetailPolicy = _activeAppEnvironment.DebugMode ? IncludeErrorDetailPolicy.LocalOnly : IncludeErrorDetailPolicy.Never; _webApiConfgurationCustomizers.ToList() .ForEach(webApiConfigurationCustomizer => { webApiConfigurationCustomizer.CustomizeWebApiConfiguration(_webApiConfig); }); _webApiConfig.DependencyResolver = _webApiDependencyResolver; HttpServer server = new HttpServer(_webApiConfig); foreach (IGrouping <string, IEdmModelProvider> edmModelProviders in _emdEdmModelProviders.GroupBy(mp => mp.GetEdmName())) { ODataModelBuilder modelBuilder = _oDataModelBuilderProvider.GetODataModelBuilder(_webApiConfig, containerName: $"{edmModelProviders.Key}Context", @namespace: edmModelProviders.Key); foreach (IEdmModelProvider edmModelProvider in edmModelProviders) { edmModelProvider.BuildEdmModel(modelBuilder); } string routeName = $"{edmModelProviders.Key}-odata"; ODataBatchHandler odataBatchHandler = new DefaultODataBatchHandler(server); odataBatchHandler.MessageQuotas.MaxOperationsPerChangeset = int.MaxValue; odataBatchHandler.MessageQuotas.MaxPartsPerBatch = int.MaxValue; odataBatchHandler.MessageQuotas.MaxNestingDepth = int.MaxValue; odataBatchHandler.MessageQuotas.MaxReceivedMessageSize = long.MaxValue; odataBatchHandler.ODataRouteName = routeName; IEnumerable <IODataRoutingConvention> conventions = ODataRoutingConventions.CreateDefault(); IEdmModel edmModel = modelBuilder.GetEdmModel(); _webApiConfig.MapODataServiceRoute(routeName, edmModelProviders.Key, builder => { builder.AddService(ServiceLifetime.Singleton, sp => conventions); builder.AddService(ServiceLifetime.Singleton, sp => edmModel); builder.AddService(ServiceLifetime.Singleton, sp => odataBatchHandler); _oDataContainerBuilderCustomizer.Customize(builder); }); } owinApp.UseAutofacWebApi(_webApiConfig); _webApiOwinPipelineInjector.UseWebApiOData(owinApp, server); _webApiConfig.EnsureInitialized(); }
public static void Register(HttpConfiguration config) { config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable<T> return type. // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries. // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712. //config.EnableQuerySupport(); const string routeName = "odata"; const string routePrefix = "odata"; var route = config.MapODataServiceRoute(routeName: routeName, routePrefix: routePrefix, configureAction: (builder => builder .AddService(ServiceLifetime.Singleton, sp => GetModel()) .AddService <ODataUriResolver>(ServiceLifetime.Singleton, sp => new UnqualifiedCallAndEnumPrefixFreeResolver { EnableCaseInsensitive = true }) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting(routeName, config)))); config.Formatters.Remove(config.Formatters.XmlFormatter); config.Filters.Add(new ExceptionLogFilterAttribute()); config.Filters.Add(new RequireValidatedCSRFAttributed()); config.Count().Filter().OrderBy().Expand().Select().MaxTop(null); }
protected override void UpdateConfiguration(WebRouteConfiguration configuration) { configuration.MapODataServiceRoute("Complex", "Complex", GetEdmModel(configuration), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); configuration.AddODataQueryFilter(); }
public static void Register(HttpConfiguration config) { // OData Routing var model = GetEdmModel(); config.MapODataServiceRoute("OData", "OData", b => b .AddService <IEdmModel>(ServiceLifetime.Singleton, s => model) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, s => ODataRoutingConventions.CreateDefaultWithAttributeRouting("OData", config)) .AddService <ODataUriResolver>(ServiceLifetime.Singleton, s => new AlternateKeysODataUriResolver(model)) ); }
/// <summary> /// Maps the specified OData route and the OData route attributes. When the <paramref name="defaultHandler"/> /// is non-<c>null</c>, it will map it as the default handler for the route. /// </summary> /// <param name="configuration">The server configuration.</param> /// <param name="routeName">The name of the route to map.</param> /// <param name="routePrefix">The prefix to add to the OData route's path template.</param> /// <param name="model">The EDM model to use for parsing OData paths.</param> /// <param name="defaultHandler">The default <see cref="HttpMessageHandler"/> for this route.</param> /// <returns>The added <see cref="ODataRoute"/>.</returns> public static ODataRoute MapODataServiceRoute(this HttpConfiguration configuration, string routeName, string routePrefix, IEdmModel model, HttpMessageHandler defaultHandler) { return(MapODataServiceRoute(configuration, routeName, routePrefix, model, new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefaultWithAttributeRouting(configuration, model), defaultHandler)); }
/// <summary> /// Maps the specified OData route and the OData route attributes. When the <paramref name="defaultHandler"/> /// is non-<c>null</c>, it will map it as the default handler for the route. /// </summary> /// <param name="configuration">The server configuration.</param> /// <param name="routeName">The name of the route to map.</param> /// <param name="routePrefix">The prefix to add to the OData route's path template.</param> /// <param name="model">The EDM model to use for parsing OData paths.</param> /// <param name="defaultHandler">The default <see cref="HttpMessageHandler"/> for this route.</param> /// <returns>The added <see cref="ODataRoute"/>.</returns> public static ODataRoute MapODataServiceRoute(this HttpConfiguration configuration, string routeName, string routePrefix, IEdmModel model, HttpMessageHandler defaultHandler) { return(configuration.MapODataServiceRoute(routeName, routePrefix, builder => builder.AddService(ServiceLifetime.Singleton, sp => model) .AddService(ServiceLifetime.Singleton, sp => defaultHandler) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting(routeName, configuration)))); }
public ODataFunctionTests() { DefaultODataPathHandler pathHandler = new DefaultODataPathHandler(); var controllers = new[] { typeof(MetadataController), typeof(FCustomersController) }; var model = GetUnTypedEdmModel(); var server = TestServerFactory.Create(controllers, (configuration) => { // without attribute routing configuration.MapODataServiceRoute("odata1", "odata", model, pathHandler, ODataRoutingConventions.CreateDefault()); // only with attribute routing IList <IODataRoutingConvention> routingConventions = new List <IODataRoutingConvention> { #if NETCORE new AttributeRoutingConvention("odata2", configuration.ServiceProvider, pathHandler) #else new AttributeRoutingConvention("odata2", configuration) #endif }; configuration.MapODataServiceRoute("odata2", "attribute", model, pathHandler, routingConventions); });
public static void Register(HttpConfiguration config) { config.MapODataServiceRoute(routeName: "odata", routePrefix: "odata", model: ProductsServiceEdmModel.GetEdmModel(), pathHandler: new PathAndSlashEscapeODataPathHandler(), routingConventions: ODataRoutingConventions.CreateDefault()); }
/// <summary> /// Maps the specified OData route and the OData route attributes. When the <paramref name="batchHandler"/> is /// non-<c>null</c>, it will create a '$batch' endpoint to handle the batch requests. /// </summary> /// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param> /// <param name="routeName">The name of the route to map.</param> /// <param name="routePrefix">The prefix to add to the OData route's path template.</param> /// <param name="model">The EDM model to use for parsing OData paths.</param> /// <param name="batchHandler">The <see cref="ODataBatchHandler"/>.</param> /// <returns>The <see cref="IEndpointRouteBuilder"/>.</returns> public static IEndpointRouteBuilder MapODataRoute(this IEndpointRouteBuilder builder, string routeName, string routePrefix, IEdmModel model, ODataBatchHandler batchHandler) { return(builder.MapODataRoute(routeName, routePrefix, containerBuilder => containerBuilder.AddService(ServiceLifetime.Singleton, sp => model) .AddService(ServiceLifetime.Singleton, sp => batchHandler) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting(routeName, builder.ServiceProvider)))); }
protected override void UpdateConfiguration(WebRouteConfiguration configuration) { configuration.Routes.Clear(); configuration.Count().Filter().OrderBy().Expand().MaxTop(null); configuration.MapODataServiceRoute("odata", "odata", GetEdmModel(configuration), new DefaultODataPathHandler(), ODataRoutingConventions.CreateDefault()); configuration.AddETagMessageHandler(new ETagMessageHandler()); }
private static HttpClient GetClient(DependencyInjectionModel instance) { IEdmModel model = GetEdmModel(); var controllers = new[] { typeof(DependencyInjectionModelsController) }; var server = TestServerFactory.Create(controllers, config => { config.MapODataServiceRoute("odata", "odata", builder => builder.AddService(ServiceLifetime.Singleton, sp => instance) .AddService(ServiceLifetime.Singleton, sp => model) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting("odata", config))); }); return(TestServerFactory.CreateClient(server)); }
public static void UpdateConfiguration(HttpConfiguration configuration) { var controllers = new[] { typeof(CustomersController), typeof(OrdersController), typeof(MetadataController) }; TestAssemblyResolver resolver = new TestAssemblyResolver(new TypesInjectionAssembly(controllers)); configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; configuration.Services.Replace(typeof(IAssembliesResolver), resolver);; configuration.Routes.Clear(); configuration.MapODataServiceRoute("odata", "odata", builder => builder.AddService(ServiceLifetime.Singleton, sp => UriParserExtenstionEdmModel.GetEdmModel()) .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting("odata", configuration)) .AddService <ODataUriResolver>(ServiceLifetime.Singleton, sp => new StringAsEnumResolver())); configuration.EnsureInitialized(); }