Exemplo n.º 1
0
        public static void UpdateConfiguration(HttpConfiguration configuration)
        {
            var controllers = new[] { typeof(DCustomersController), typeof(MetadataController), typeof(EfCustomersController) };
            TestAssemblyResolver resolver = new TestAssemblyResolver(new TypesInjectionAssembly(controllers));

            configuration.Services.Replace(typeof(IAssembliesResolver), resolver);

            configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); // -8:00

            configuration.SetTimeZoneInfo(timeZoneInfo);

            configuration.Routes.Clear();
            HttpServer httpServer = configuration.GetHttpServer();

            configuration.Count().Filter().OrderBy().Expand().MaxTop(null);
            configuration.MapODataServiceRoute(
                routeName: "convention",
                routePrefix: "convention",
                model: DateAndTimeOfDayEdmModel.GetConventionModel());

            configuration.MapODataServiceRoute(
                routeName: "explicit",
                routePrefix: "explicit",
                model: DateAndTimeOfDayEdmModel.GetExplicitModel(),
                batchHandler: new DefaultODataBatchHandler(httpServer));

            configuration.EnsureInitialized();
        }
Exemplo n.º 2
0
        public static void UpdateConfiguration(HttpConfiguration configuration)
        {
            var controllers = new[] { typeof(EfPeopleController) };
            TestAssemblyResolver resolver = new TestAssemblyResolver(new TypesInjectionAssembly(controllers));

            configuration.Services.Replace(typeof(IAssembliesResolver), resolver);

            configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            IEdmModel model = DateAndTimeOfDayEdmModel.BuildEfPersonEdmModel();

            model.SetPayloadValueConverter(new MyConverter());

            configuration.Routes.Clear();
            configuration.MapODataServiceRoute("odata", "odata", model);

            configuration.EnsureInitialized();
        }
Exemplo n.º 3
0
        public static void UpdateConfiguration(HttpConfiguration configuration)
        {
            var controllers = new[] { typeof(EfPeopleController) };
            TestAssemblyResolver resolver = new TestAssemblyResolver(new TypesInjectionAssembly(controllers));

            configuration.Services.Replace(typeof(IAssembliesResolver), resolver);

            configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            IEdmModel model = DateAndTimeOfDayEdmModel.BuildEfPersonEdmModel();

            // TODO: modify it after implement the DI in Web API.
            // model.SetPayloadValueConverter(new MyConverter());

            configuration.Routes.Clear();
            configuration.Count().Filter().OrderBy().Expand().MaxTop(null);
            configuration.MapODataServiceRoute("odata", "odata", model);

            configuration.EnsureInitialized();
        }