Exemplo n.º 1
0
        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.EnableCaseInsensitive(true);

            configuration.Routes.Clear();

            configuration.MapODataServiceRoute(routeName: "odata",
                                               routePrefix: "odata", model: UriParserExtenstionEdmModel.GetEdmModel());

            configuration.EnsureInitialized();
        }
Exemplo n.º 2
0
        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();
        }