コード例 #1
0
ファイル: Global.asax.cs プロジェクト: tantt2810/OData
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(config => {
         WebApiConfig.Register(config);
         ODataConfig.Register(config);
     });
 }
コード例 #2
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     //  GlobalConfiguration.Configure(WebApiConfig.Register);
     GlobalConfiguration.Configure(config =>
     {
         ODataConfig.Register(config); //this has to be before WebApi
         WebApiConfig.Register(config);
     });
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
コード例 #3
0
        public static void Register(HttpConfiguration config)
        {
            config.Filters.Add(new AuthorizeAttribute());
            config.Filters.Add(new DSWExceptionFilterAttribute());

            // Web API configuration and services
            config.MapHttpAttributeRoutes(new DSWWebApiRouteProvider());
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            config.EnableCors();

            ODataConfig.Register(config);
            config.EnableDependencyInjection();
            config.EnsureInitialized();
        }
コード例 #4
0
ファイル: Global.asax.cs プロジェクト: mrtienthinh/Egreeting2
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            UnityConfig.RegisterComponents();
            GlobalConfiguration.Configure(config =>
            {
                WebApiConfig.Register(config);
                ODataConfig.Register(config); //this has to be before WebApi
            });
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            log4net.Config.XmlConfigurator.Configure();
        }
コード例 #5
0
        public static void StartWebApi(IAppBuilder app)
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion <ShowcaseDbContext, Configuration>());
            AutoMapperConfig.RegisterMappings(Assembly.Load(Constants.DataTransferModelsAssembly));

            var httpConfig = new HttpConfiguration();

            ODataConfig.Register(httpConfig);
            WebApiConfig.Register(httpConfig);

            httpConfig.EnsureInitialized();

            app
            .UseNinjectMiddleware(NinjectConfig.CreateKernel)
            .UseNinjectWebApi(httpConfig);
        }