internal static void ConfigureODataService(HttpServer server)
		{
			// Configure OData controllers
			var oDataServerConfigurer = new ODataServerConfigurer(server.Configuration);

			oDataServerConfigurer.AddStandardEntitySetControllers();
			oDataServerConfigurer.ConfigureODataRoutes(server.Configuration.Routes, "ODataRoute", "odata", server);
		}
Пример #2
0
        public static void Register(HttpConfiguration config)
        {
            // Pull the container metadata from the DI service
            var containerMetadata = EntityRepository.ODataServer.Util.WebExtensions.Resolve<IContainerMetadata<ScrumDb>>(config.DependencyResolver);

            // Configure OData controllers
            var oDataServerConfigurer = new ODataServerConfigurer(config);

            // Just to prove that regular controller classes can be added when customization is needed
            //oDataServerConfigurer.AddEntitySetController("Projects", typeof(Project), typeof(ProjectsController));
            //oDataServerConfigurer.AddEntitySetController("Users", typeof(User), typeof(UsersController));

            oDataServerConfigurer.AddStandardEntitySetControllers(DbSetControllerSelector);
            oDataServerConfigurer.ConfigureODataRoutes(config.Routes, "ODataRoute", ODataRoute, GlobalConfiguration.DefaultServer);
        }
Пример #3
0
		internal static void ConfigureODataService(HttpConfiguration webApiConfig, HttpServer webApiServer)
		{
			// Configure OData controllers
			var oDataServerConfigurer = new ODataServerConfigurer(webApiConfig);

			// Just to prove that regular controller classes can be added when customization is needed
			// However, this isn't needed, b/c the dependency injector normally picks up all controllers in the assembly.
			//oDataServerConfigurer.AddEntitySetController("Projects", typeof(Project), typeof(ProjectsController));
			//oDataServerConfigurer.AddEntitySetController("Users", typeof(User), typeof(UsersController));

			oDataServerConfigurer.AddStandardEntitySetControllers(DbSetControllerSelector);

			// TODO: Remove this - using to compare ODataConventionModelBuilder's EDM to what EF creates.
			var odataModelBuilder = new ODataConventionModelBuilder(webApiConfig);
			odataModelBuilder.ConfigureFromContainer(oDataServerConfigurer.ContainerMetadata);

			oDataServerConfigurer.ConfigureODataRoutes(webApiConfig.Routes, "ODataRoute", ODataRoute, webApiServer,
				// TODO: Remove this arg
				odataModelBuilder.GetEdmModel());
		}