コード例 #1
0
        /// <summary>
        /// Configures the o data.
        /// </summary>
        /// <param name="app">The application.</param>
        public static void ConfigureOData(IAppBuilder app)
        {
            //HttpConfig.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            // Web-API-Konfiguration und -Dienste
            HttpConfig.Select()
            .Filter()
            .OrderBy()
            .MaxTop(null)
            .Count();

            var httpServer = new HttpServer(HttpConfig);

            var modelBuilder = new VersionedODataModelBuilder(HttpConfig)
            {
                ModelBuilderFactory = () => new ODataConventionModelBuilder(),
                ModelConfigurations =
                {
                    new NVEntitySetConfiguration <NVArticle>(),
                    new NVConfiguration()
                }
            };

            HttpConfig.MapVersionedODataRoutes("odata", "", modelBuilder.GetEdmModels(), new DefaultODataBatchHandler(httpServer));
        }