Ejemplo n.º 1
0
        public static void Register(HttpConfiguration config)
        {
            SuperscribeConfig.Register(config);
            var engine = RouteEngineFactory.Create();

            config.DependencyResolver = new SuperscribeDependencyAdapter(config.DependencyResolver, engine);

            engine.Route("Any" / Any.Controller / Any.Action / (Int)"siteId");

            var forms     = engine.Route(r => r / "api" / (Long)"parentId" / "Forms".Controller());
            var blog      = engine.Route(r => r / "sites" / (Int)"siteId" / "blog");
            var portfolio = engine.Route(r => r / "sites" / (Int)"siteId" / "portfolio");

            var blogposts = engine.Route(blog / "posts".Controller("blogposts"));

            engine.Route(forms / "VisibleFor" / (String)"appDataId", To.Action("VisibleFor"));
            engine.Route(forms / (Long)"id", To.Action("GetById"));

            engine.Route(blog / "tags".Controller("blogtags"));

            engine.Route(blogposts / (Int)"postId" / "media".Controller("blogpostmedia")
                         / (Int)"id");

            engine.Route(blogposts / "archives".Controller("blogpostarchives") / (Int)"year"
                         / (Int)"month");

            engine.Route(portfolio / "projects".Controller("portfolioprojects")
                         / (Int)"projectId" / "media".Controller("portfolioprojectmedia") / (Int)"id");

            engine.Route(portfolio / "tags".Controller("portfoliotags"));
            engine.Route(portfolio / "categories".Controller("portfoliocategories") / (Int)"id");
        }
Ejemplo n.º 2
0
        public static void Register(HttpConfiguration config)
        {
            var engine = SuperscribeConfig.Register(config);

            var site = engine.Route(o => o / "sites" / (Int)"siteId");

            var blog      = site / "blog";
            var blogposts = blog / "posts".Controller("blogposts");

            for (var i = 0; i < 250; i++)
            {
                GenerateRoutes(engine, site, Guid.NewGuid().ToString());
            }

            GenerateRoutes(engine, site, "portfolio");

            // sites/{siteId}/blog/posts/
            // sites/{siteId}/blog/posts/{postId}
            // sites/{siteId}/blog/posts/{postId}/media
            // sites/{siteId}/blog/posts/{postId}/media/{id}
            engine.Route(o => blogposts / (Int)"postId" / "media".Controller("blogpostmedia") / (Int)"id");

            // sites/{siteId}/blog/tags
            engine.Route(o => blog / "tags".Controller("blogtags"));

            // sites/{siteId}/blog/posts/archives
            // sites/{siteId}/blog/posts/archives/{year}/{month}
            engine.Route(o => blogposts / "archives".Controller("blogpostarchives") / (Int)"year" / (Int)"month");

            //for (var i = 0; i < 50; i++)
            //{
            //    GenerateRoutes(site, Guid.NewGuid().ToString());
            //}
        }
Ejemplo n.º 3
0
        public static void Register(HttpConfiguration config)
        {
            var engine = SuperscribeConfig.Register(config);

            engine.Route("sites" / (Int)"siteId" / "blog" / "tags".Controller("blogtags"));
            engine.Route("sites" / (Int)"siteId" / "blog" / "posts".Controller("blogposts") / (Int)"postId" / "media".Controller("blogpostmedia") / (Int)"id");
            engine.Route("sites" / (Int)"siteId" / "blog" / "posts".Controller("blogposts") / "archives".Controller("blogpostarchives") / (Int)"year" / (Int)"month");
            engine.Route("sites" / (Int)"siteId" / "portfolio" / "projects".Controller("portfolioprojects") / (Int)"projectId" / "media".Controller("portfolioprojectmedia") / (Int)"id");
            engine.Route("sites" / (Int)"siteId" / "portfolio" / "tags".Controller("portfoliotags"));
            engine.Route("sites" / (Int)"siteId" / "portfolio" / "categories".Controller("portfoliocategories") / (Int)"id");
        }
Ejemplo n.º 4
0
        public void Configuration(IAppBuilder app)
        {
            var engine = OwinRouteEngineFactory.Create();

            var httpconfig = new HttpConfiguration();

            SuperscribeConfig.Register(httpconfig, engine);

            engine.Route(o => "Values".Controller());

            app.UseSuperscribeRouter(engine)
            .UseWebApi(httpconfig)
            .WithSuperscribe(httpconfig, engine);
        }