示例#1
0
 protected virtual void RegisterDefaultRoutes(
     RouteCollection routes,
     IRouteHandler portalRouteHandler,
     IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
     IEmbeddedResourceRouteHandler scriptHandler)
 {
     routes.Add(portalRouteHandler.GetType().FullName, new Route("{*path}", portalRouteHandler));
 }
示例#2
0
 protected virtual void RegisterIgnoreRoutes(
     RouteCollection routes,
     IRouteHandler portalRouteHandler,
     IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
     IEmbeddedResourceRouteHandler scriptHandler)
 {
     routes.Ignore("{resource}.axd/{*pathInfo}");
     routes.Ignore("{resource}.svc/{*pathInfo}");
 }
示例#3
0
        protected virtual void RegisterEmbeddedResourceRoutes(
            RouteCollection routes,
            IRouteHandler portalRouteHandler,
            IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
            IEmbeddedResourceRouteHandler scriptHandler)
        {
            // register embedded resource handler routes

            Register(routes, _prefix, embeddedResourceRouteHandler, scriptHandler);
        }
示例#4
0
        protected virtual void RegisterCustomRoutes(
            RouteCollection routes,
            IRouteHandler portalRouteHandler,
            IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
            IEmbeddedResourceRouteHandler scriptHandler)
        {
            var entityRouteHandler = new EntityRouteHandler(PortalName);

            routes.Add(
                entityRouteHandler.GetType().FullName,
                new Route("_entity/{logicalName}/{id}", entityRouteHandler));
        }
        protected override void Register(
            RouteCollection routes,
            string prefix,
            IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
            IEmbeddedResourceRouteHandler scriptHandler)
        {
            if (UseEmbeddedResourceVirtualPathProvider)
            {
                // ignore the prefix to allow the EmbeddedResourceVirtualPathProvider to handle the request

                routes.Ignore(prefix + "/{*pathInfo}");
            }
            else
            {
                // add the combined script handler

                var contstraints = new RouteValueDictionary(new { prefix });

                routes.Add(
                    "type={0},prefix={1}".FormatWith(scriptHandler, prefix),
                    new Route(
                        "{prefix}/js/xrm-combined.js/{*pathInfo}",
                        null,
                        contstraints,
                        scriptHandler));

                // keep this route until the xrm-combined-js.aspx is removed from the files project

                routes.Add(
                    "type={0},prefix={1},extension=aspx".FormatWith(scriptHandler, prefix),
                    new Route(
                        "{prefix}/js/xrm-combined-js.aspx/{*pathInfo}",
                        null,
                        contstraints,
                        scriptHandler));

                // add the embedded resource handler

                routes.Add(
                    "type={0},prefix={1}".FormatWith(embeddedResourceRouteHandler, prefix),
                    new Route(
                        "{prefix}/{*path}",
                        null,
                        contstraints,
                        embeddedResourceRouteHandler));
            }

            if (CdnEnabled)
            {
                RegisterCdn(routes, prefix, embeddedResourceRouteHandler, scriptHandler);
            }
        }
        protected override void RegisterEmbeddedResourceRoutes(
            RouteCollection routes,
            IRouteHandler portalRouteHandler,
            IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
            IEmbeddedResourceRouteHandler scriptHandler)
        {
            base.RegisterEmbeddedResourceRoutes(routes, portalRouteHandler, embeddedResourceRouteHandler, scriptHandler);

            // register custom embedded resource handler routes

            var paths = GetPaths(_prefix, _paths).ToArray();
            var customScriptHandler = new CompositeEmbeddedResourceRouteHandler(scriptHandler.Mappings, paths);

            // register embedded resource handler routes

            Register(routes, _prefix, embeddedResourceRouteHandler, customScriptHandler);
        }
示例#7
0
        protected virtual void RegisterStaticRoutes(
            RouteCollection routes,
            IRouteHandler portalRouteHandler,
            IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
            IEmbeddedResourceRouteHandler scriptHandler)
        {
            if (IncludeCacheInvalidationHandler)
            {
                // add the cache invalidation handler

                var cacheInvalidationHandler = new CacheInvalidationHandler();

                routes.Add(
                    cacheInvalidationHandler.GetType().FullName,
                    new Route("Cache.axd/{*pathInfo}", null, null, cacheInvalidationHandler));
            }
        }
        protected override void RegisterDefaultRoutes(
            RouteCollection routes,
            IRouteHandler portalRouteHandler,
            IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
            IEmbeddedResourceRouteHandler scriptHandler)
        {
            // swap out the PortalRouteHandler with a custom dependency (keeping the base script handler)

            var portalRouteHandlerAdx = new Adxstudio.Xrm.Web.Routing.PortalRouteHandler(PortalName);

            if (CdnEnabled)
            {
                var route = new Route("{cdn}/{*path}", null, new RouteValueDictionary(new { cdn = "cdn" }), portalRouteHandlerAdx);
                routes.Add(portalRouteHandler.GetType().FullName + ",cdn", route);
            }

            base.RegisterDefaultRoutes(routes, portalRouteHandlerAdx, embeddedResourceRouteHandler, scriptHandler);
        }
示例#9
0
        protected virtual RouteCollection Register(
            RouteCollection routes,
            IRouteHandler portalRouteHandler,
            IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
            IEmbeddedResourceRouteHandler scriptHandler)
        {
            RegisterStaticRoutes(routes, portalRouteHandler, embeddedResourceRouteHandler, scriptHandler);

            RegisterEmbeddedResourceRoutes(routes, portalRouteHandler, embeddedResourceRouteHandler, scriptHandler);

            RegisterIgnoreRoutes(routes, portalRouteHandler, embeddedResourceRouteHandler, scriptHandler);

            RegisterCustomRoutes(routes, portalRouteHandler, embeddedResourceRouteHandler, scriptHandler);

            RegisterDefaultRoutes(routes, portalRouteHandler, embeddedResourceRouteHandler, scriptHandler);

            return(routes);
        }
        protected virtual void RegisterCdn(
            RouteCollection routes,
            string prefix,
            IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
            IEmbeddedResourceRouteHandler scriptHandler)
        {
            // add the combined script handler

            var contstraints = new RouteValueDictionary(new { prefix, cdn = "cdn" });

            routes.Add(
                "type={0},prefix={1},cdn".FormatWith(scriptHandler, prefix),
                new Route(
                    "{cdn}/{prefix}/js/xrm-combined.js/{*pathInfo}",
                    null,
                    contstraints,
                    scriptHandler));

            // keep this route until the xrm-combined-js.aspx is removed from the files project

            routes.Add(
                "type={0},prefix={1},extension=aspx,cdn".FormatWith(scriptHandler, prefix),
                new Route(
                    "{cdn}/{prefix}/js/xrm-combined-js.aspx/{*pathInfo}",
                    null,
                    contstraints,
                    scriptHandler));

            // add the embedded resource handler

            routes.Add(
                "type={0},prefix={1},cdn".FormatWith(embeddedResourceRouteHandler, prefix),
                new Route(
                    "{cdn}/{prefix}/{*path}",
                    null,
                    contstraints,
                    embeddedResourceRouteHandler));
        }
        protected override void RegisterCustomRoutes(
            RouteCollection routes,
            IRouteHandler portalRouteHandler,
            IEmbeddedResourceRouteHandler embeddedResourceRouteHandler,
            IEmbeddedResourceRouteHandler scriptHandler)
        {
            var entityRouteHandler = new Adxstudio.Xrm.Web.Routing.EntityRouteHandler(PortalName);

            routes.Add(
                entityRouteHandler.GetType().FullName,
                new Route(
                    "{prefix}/{logicalName}/{id}",
                    null,
                    new RouteValueDictionary(new { prefix = "_entity" }),
                    entityRouteHandler));

            routes.Add(
                entityRouteHandler.GetType().FullName + "PortalScoped",
                new Route(
                    "{prefix}/{logicalName}/{id}/{__portalScopeId__}",
                    null,
                    new RouteValueDictionary(new { prefix = "_entity" }),
                    entityRouteHandler));

            if (CdnEnabled)
            {
                routes.Add(
                    entityRouteHandler.GetType().FullName + ",cdn",
                    new Route(
                        "{cdn}/{prefix}/{logicalName}/{id}",
                        null,
                        new RouteValueDictionary(new { prefix = "_entity", cdn = "cdn" }),
                        entityRouteHandler));
            }

            var webResourceRouteHandler = new WebResourceRouteHandler(PortalName);

            routes.Add(
                webResourceRouteHandler.GetType().FullName,
                new Route(
                    "{prefix}/{name}",
                    null,
                    new RouteValueDictionary(new { prefix = "_webresource" }),
                    webResourceRouteHandler));

            if (CdnEnabled)
            {
                routes.Add(
                    webResourceRouteHandler.GetType().FullName + ",cdn",
                    new Route(
                        "{cdn}/{prefix}/{name}",
                        null,
                        new RouteValueDictionary(new { prefix = "_webresource", cdn = "cdn" }),
                        webResourceRouteHandler));
            }

            var servicesConstraints = new RouteValueDictionary(new { area = "_services" });

            routes.Add(typeof(ElFinderRouteHandler).FullName, new Route(ElFinderRouteHandler.RoutePath, new ElFinderRouteHandler(PortalName)));

            routes.MapRoute("CmsTemplate_GetAll",
                            "_services/portal/{__portalScopeId__}/{entityLogicalname}/{id}/__templates/all/{currentSiteMapNodeUrl}",
                            new { controller = "CmsTemplate", action = "GetAll" },
                            new[] { "Adxstudio.Xrm.Web.Mvc.Controllers" });

            routes.MapRoute("CmsTemplate_Get",
                            "_services/portal/{__portalScopeId__}/{entityLogicalname}/{id}/__templates/source/{encodedName}",
                            new { controller = "CmsTemplate", action = "Get" },
                            new[] { "Adxstudio.Xrm.Web.Mvc.Controllers" });

            routes.MapRoute("CmsTemplate_GetPreview",
                            "_services/portal/{__portalScopeId__}/{entityLogicalname}/{id}/__templates/preview/{encodedName}/{__currentSiteMapNodeUrl__}",
                            new { controller = "CmsTemplate", action = "GetPreview" },
                            new[] { "Adxstudio.Xrm.Web.Mvc.Controllers" });

            routes.MapRoute("CmsTemplate_GetLivePreview",
                            "_services/portal/{__portalScopeId__}/{entityLogicalname}/{id}/__templates/live-preview/{__currentSiteMapNodeUrl__}",
                            new { controller = "CmsTemplate", action = "GetLivePreview" },
                            new[] { "Adxstudio.Xrm.Web.Mvc.Controllers" });

            routes.MapRoute("CmsParent_GetParentOptions",
                            "_services/portal/{__portalScopeId__}/__parents",
                            new { controller = "CmsParent", action = "GetParentOptions" },
                            new[] { "Adxstudio.Xrm.Web.Mvc.Controllers" });

            routes.MapRoute("CmsParent_GetParentOptionsForEntity",
                            CmsParentController.GetParentOptionsForEntityRoutePath,
                            new { controller = "CmsParent", action = "GetParentOptionsForEntity" },
                            new[] { "Adxstudio.Xrm.Web.Mvc.Controllers" });

            routes.Add(typeof(CmsEntityChildrenRouteHandler).FullName, new Route(CmsEntityChildrenRouteHandler.RoutePath, new CmsEntityChildrenRouteHandler(PortalName)));
            routes.Add(typeof(CmsEntityDeleteRouteHandler).FullName, new Route(CmsEntityDeleteRouteHandler.RoutePath, new CmsEntityDeleteRouteHandler(PortalName)));
            routes.Add(typeof(CmsEntityFileAttachmentRouteHandler).FullName, new Route(CmsEntityFileAttachmentRouteHandler.RoutePath, new CmsEntityFileAttachmentRouteHandler(PortalName)));
            routes.Add(typeof(CmsEntityUrlRouteHandler).FullName, new Route(CmsEntityUrlRouteHandler.RoutePath, new CmsEntityUrlRouteHandler(PortalName)));
            routes.Add(typeof(CmsEntityAttributeRouteHandler).FullName, new Route(CmsEntityAttributeRouteHandler.RoutePath, new CmsEntityAttributeRouteHandler(PortalName)));
            routes.Add(typeof(CmsEntityRelationshipRouteHandler).FullName, new Route(CmsEntityRelationshipRouteHandler.RoutePath, new CmsEntityRelationshipRouteHandler(PortalName)));
            routes.Add(typeof(CmsEntityRouteHandler).FullName, new Route(CmsEntityRouteHandler.RoutePath, new CmsEntityRouteHandler(PortalName)));
            routes.Add(typeof(CmsEntitySetRouteHandler).FullName, new Route(CmsEntitySetRouteHandler.RoutePath, new CmsEntitySetRouteHandler(PortalName)));
            routes.Add(typeof(OrganizationServiceCachePluginMessageRouteHandler).FullName, new Route(OrganizationServiceCachePluginMessageRouteHandler.RoutePath, null, servicesConstraints, new OrganizationServiceCachePluginMessageRouteHandler(PortalName)));
            routes.Add(typeof(BlogFeedRouteHandler).FullName, new Route(BlogFeedRouteHandler.RoutePath, new BlogFeedRouteHandler(PortalName)));
            routes.Add(typeof(WebsiteBlogAggregationFeedRouteHandler).FullName, new Route(WebsiteBlogAggregationFeedRouteHandler.RoutePath, new WebsiteBlogAggregationFeedRouteHandler(PortalName)));
        }
示例#12
0
 protected override RouteCollection Register(RouteCollection routes, IRouteHandler portalRouteHandler, IEmbeddedResourceRouteHandler embeddedResourceRouteHandler, IEmbeddedResourceRouteHandler scriptHandler)
 {
     RegisterEmbeddedResourceRoutes(routes, portalRouteHandler, embeddedResourceRouteHandler, scriptHandler);
     return(routes);
 }