Exemple #1
0
        public static void UpdateConfiguration(HttpConfiguration configuration)
        {
            var controllers = new[] { typeof(ForeignKeyCustomersController),
                                      typeof(ForeignKeyOrdersController),
                                      typeof(ForeignKeyCustomersNoCascadeController),
                                      typeof(ForeignKeyOrdersNoCascadeController),
                                      typeof(MetadataController) };

            TestAssemblyResolver resolver = new TestAssemblyResolver(new TypesInjectionAssembly(controllers));

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

            configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            configuration.Routes.Clear();
            configuration.GetHttpServer();
            configuration.Count().Filter().OrderBy().Expand().MaxTop(null);
            configuration.MapODataServiceRoute(routeName: "explicit", routePrefix: "explicit",
                                               model: ForeignKeyEdmModel.GetExplicitModel(foreignKey: true));

            configuration.MapODataServiceRoute(routeName: "convention", routePrefix: "convention",
                                               model: ForeignKeyEdmModel.GetConventionModel());

            configuration.MapODataServiceRoute(routeName: "noncascade", routePrefix: "noncascade",
                                               model: ForeignKeyEdmModel.GetExplicitModel(foreignKey: false));

            configuration.EnsureInitialized();
        }
Exemple #2
0
        public static void UpdateConfiguration(HttpConfiguration configuration)
        {
            configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

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

            configuration.Routes.MapODataServiceRoute(routeName: "explicit", routePrefix: "explicit",
                                                      model: ForeignKeyEdmModel.GetExplicitModel(foreignKey: true));

            configuration.Routes.MapODataServiceRoute(routeName: "convention", routePrefix: "convention",
                                                      model: ForeignKeyEdmModel.GetConventionModel());

            configuration.Routes.MapODataServiceRoute(routeName: "noncascade", routePrefix: "noncascade",
                                                      model: ForeignKeyEdmModel.GetExplicitModel(foreignKey: false));

            configuration.EnsureInitialized();
        }