Example #1
0
        public static void UpdateConfiguration(HttpConfiguration configuration)
        {
            var controllers = new[]
            {
                typeof(CustomersController), typeof(OrdersController), typeof(PeopleController),
                typeof(CompaniesController), typeof(MetadataController)
            };

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

            configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            configuration.Services.Replace(typeof(IAssembliesResolver), resolver);

            IEdmModel model = AlternateKeysEdmModel.GetEdmModel();

            configuration.Routes.Clear();

            configuration.Count().Filter().OrderBy().Expand().MaxTop(null);

            configuration.MapODataServiceRoute("odata", "odata",
                                               builder =>
                                               builder.AddService(ServiceLifetime.Singleton, sp => model)
                                               .AddService <IEnumerable <IODataRoutingConvention> >(ServiceLifetime.Singleton, sp =>
                                                                                                    ODataRoutingConventions.CreateDefaultWithAttributeRouting("odata", configuration))
                                               .AddService <ODataUriResolver>(ServiceLifetime.Singleton, sp => new AlternateKeysODataUriResolver(model)));

            configuration.EnsureInitialized();
        }
Example #2
0
        public static void UpdateConfiguration(HttpConfiguration configuration)
        {
            var controllers = new[]
            {
                typeof(CustomersController), typeof(OrdersController), typeof(PeopleController),
                typeof(CompaniesController), typeof(MetadataController)
            };

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

            configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            configuration.Services.Replace(typeof(IAssembliesResolver), resolver);

            configuration.EnableAlternateKeys(true);

            configuration.Routes.Clear();
            IEdmModel model = AlternateKeysEdmModel.GetEdmModel();

            configuration.MapODataServiceRoute("odata", "odata", model: AlternateKeysEdmModel.GetEdmModel());

            var conventions = ODataRoutingConventions.CreateDefault();

            configuration.MapODataServiceRoute("odata1", "convention", model, new DefaultODataPathHandler(), conventions);

            configuration.EnsureInitialized();
        }
Example #3
0
        static AlternateKeysDataSource()
        {
            IEdmModel model = AlternateKeysEdmModel.GetEdmModel();

            BuildCustomers(model);

            BuildOrderss(model);

            BuildPeople(model);

            BuildCompanies(model);
        }