Exemplo n.º 1
0
        protected override void UpdateConfiguration(WebRouteConfiguration configuration)
        {
            var controllers = new[]
            {
                typeof(CustomersController), typeof(OrdersController), typeof(PeopleController),
                typeof(CompaniesController), typeof(MetadataController)
            };

            configuration.AddControllers(controllers);

            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();
        }
Exemplo n.º 2
0
        static AlternateKeysDataSource()
        {
            IEdmModel model = AlternateKeysEdmModel.GetEdmModel();

            BuildCustomers(model);

            BuildOrderss(model);

            BuildPeople(model);

            BuildCompanies(model);
        }