public void Initialize(HttpConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (this.domains != null)
            {
                config.SetCrossDomainOrigins(this.domains);
            }

            // register the controller as an exclusion so it does not map to /api
            MobileAppConfiguration mobileAppConfig = config.GetMobileAppConfiguration();

            mobileAppConfig.AddBaseRouteExclusion(CrossDomainControllerName);

            HttpRouteCollectionExtensions.MapHttpRoute(
                config.Routes,
                name: CrossDomainBridgeRouteName,
                routeTemplate: "crossdomain/bridge",
                defaults: new { controller = CrossDomainControllerName });

            HttpRouteCollectionExtensions.MapHttpRoute(
                config.Routes,
                name: CrossDomainLoginReceiverRouteName,
                routeTemplate: "crossdomain/loginreceiver",
                defaults: new { controller = CrossDomainControllerName });
        }
        public void Initialize(HttpConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            //register the controller as an exclusion so it does not map to / api
            MobileAppConfiguration mobileAppConfig = config.GetMobileAppConfiguration();

            mobileAppConfig.AddBaseRouteExclusion(PushControllerName);

            //HttpRouteCollectionExtensions.MapHttpRoute(
            //    config.Routes,
            //    name: NotificationInstallationsRouteName,
            //    routeTemplate: PushRoutePrefix + "{installationId}",
            //    defaults: new { controller = PushControllerName });
        }
コード例 #3
0
        /// <summary>
        /// </summary>
        /// <param name="config">HttpConfiguration</param>
        public void Initialize(HttpConfiguration config)
        {
            HashSet <string>            tableControllerNames      = config.GetTableControllerNames();
            SetRouteConstraint <string> tableControllerConstraint = new SetRouteConstraint <string>(tableControllerNames, matchOnExcluded: false);

            // register all TableControllers as exclusions so they do not map to /api
            MobileAppConfiguration mobileAppConfig = config.GetMobileAppConfiguration();

            foreach (string controllerName in tableControllerNames)
            {
                mobileAppConfig.AddBaseRouteExclusion(controllerName);
            }

            HttpRouteCollectionExtensions.MapHttpRoute(
                config.Routes,
                name: TablesRouteName,
                routeTemplate: "tables/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional },
                constraints: new { controller = tableControllerConstraint });
        }