コード例 #1
0
ファイル: AlternateKeysTest.cs プロジェクト: bdebaere/WebApi
        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();
        }
コード例 #2
0
        static AlternateKeysDataSource()
        {
            IEdmModel model = AlternateKeysEdmModel.GetEdmModel();

            BuildCustomers(model);

            BuildOrderss(model);

            BuildPeople(model);

            BuildCompanies(model);
        }