public void ConfigureEndpoints(IEndpointRouteBuilder endpoints)
 {
 }
        public static IEndpointRouteBuilder Use(IEndpointRouteBuilder routeBuilder)
        {
            routeBuilder.MapControllerRoute(
                null,
                "media/{pid}/{title}",
                defaults: new { controller = "media", action = "Index" }
                );

            routeBuilder.MapControllerRoute(
                null,
                "videoframe/{pid}/{title}",
                defaults: new { controller = "videoframe", action = "Index" }
                );

            #region User Profile
            routeBuilder.MapControllerRoute(
                null,
                "user/profile/{username}",
                defaults: new { controller = "user", action = "profile" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "user/videos/{username}",
                defaults: new { controller = "user", action = "videos" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "user/videos/{username}/{id}",
                defaults: new { controller = "user", action = "videos" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "user/{username}",
                defaults: new { controller = "user", action = "Index" }

                );
            #endregion


            #region Videos

            // video category processing routes
            routeBuilder.MapControllerRoute(
                null,
                "videos/category/filter/{title}/{filter}",
                defaults: new { controller = "videos", action = "category" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/category/filter/{title}/{filter}/{pagenumber}",
                defaults: new { controller = "videos", action = "category" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/category/filter/{title}/{filter}/{order}",
                defaults: new { controller = "videos", action = "category" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/category/filter/{title}/{filter}/{order}/{pagenumber}",
                defaults: new { controller = "videos", action = "category" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/category/{title}/{order}",
                defaults: new { controller = "videos", action = "category" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/category/{title}/{order}/{pagenumber}",
                defaults: new { controller = "videos", action = "category" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/category/{title}",
                defaults: new { controller = "videos", action = "category" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/category/{title}/{pagenumber}",
                defaults: new { controller = "videos", action = "category" }

                );

            // video tag processing routes
            routeBuilder.MapControllerRoute(
                null,
                "videos/label/filter/{title}/{filter}",
                defaults: new { controller = "videos", action = "label" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/label/filter/{title}/{filter}/{pagenumber}",
                defaults: new { controller = "videos", action = "label" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/label/filter/{title}/{filter}/{order}",
                defaults: new { controller = "videos", action = "label" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/label/filter/{title}/{filter}/{order}/{pagenumber}",
                defaults: new { controller = "videos", action = "label" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/label/{title}/{order}/{pagenumber}",
                defaults: new { controller = "videos", action = "label" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/label/{title}/{order}",
                defaults: new { controller = "videos", action = "label" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/label/{title}/{order}/{pagenumber}",
                defaults: new { controller = "videos", action = "label" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/label/{title}",
                defaults: new { controller = "videos", action = "label" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/label/{title}/{pagenumber}",
                defaults: new { controller = "videos", action = "label" }

                );

            // video archive processing routes

            routeBuilder.MapControllerRoute(
                null,
                "videos/archive/{month}/{year}/{order}",
                defaults: new { controller = "videos", action = "archive" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/archive/{month}/{year}/{order}/{pagenumber}",
                defaults: new { controller = "videos", action = "archive" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/archive/{month}/{year}",
                defaults: new { controller = "videos", action = "archive" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/archive/{month}/{year}/{pagenumber}",
                defaults: new { controller = "videos", action = "archive" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/categories",
                defaults: new { controller = "videos", action = "categories" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/categories/{pagenumber}",
                defaults: new { controller = "videos", action = "categories" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/archivelist",
                defaults: new { controller = "videos", action = "archivelist" }
                );

            // video taglist routes
            routeBuilder.MapControllerRoute(
                null,
                "videos/labels",
                defaults: new { controller = "videos", action = "labels" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/labels/{pagenumber}",
                defaults: new { controller = "videos", action = "labels" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/labels/search/{term}",
                defaults: new { controller = "videos", action = "labels" }

                );
            routeBuilder.MapControllerRoute(
                null,
                "videos/labels/search/{term}/{pagenumber}",
                defaults: new { controller = "videos", action = "labels" }

                );
            // search routes
            routeBuilder.MapControllerRoute(
                null,
                "videos/queryresult",
                defaults: new { controller = "videos", action = "queryresult" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/search/filter/{filter}/{term}",
                defaults: new { controller = "videos", action = "search" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/search/filter/{filter}/{term}/{pagenumber}",
                defaults: new { controller = "videos", action = "search" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/search/{term}",
                defaults: new { controller = "videos", action = "search" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/search/{term}/{pagenumber}",
                defaults: new { controller = "videos", action = "search" }

                );


            routeBuilder.MapControllerRoute(
                null,
                "videos/page/{pagenumber}",
                defaults: new { controller = "videos", action = "Index" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/{order}/{filter}",
                defaults: new { controller = "videos", action = "Index" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/{order}/{filter}/{pagenumber}",
                defaults: new { controller = "videos", action = "Index" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/{order}",
                defaults: new { controller = "videos", action = "Index" }

                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/{order}/{pagenumber}",
                defaults: new { controller = "videos", action = "Index" }
                );

            routeBuilder.MapControllerRoute(
                null,
                "videos/",
                defaults: new { controller = "videos", action = "Index" }
                );

            #endregion


            routeBuilder.MapControllerRoute(
                name: "ActionApi",
                pattern: "api/{controller}/{action}/{name?}"
                );

            routeBuilder.MapControllerRoute(
                null,
                "/account/{*url}",
                defaults: new { controller = "account", action = "Index" }
                );

            routeBuilder.MapControllerRoute(
                null,
                "/admin/{*url}",
                defaults: new { controller = "admin", action = "Index" }
                );

            routeBuilder.MapFallbackToController("account/", "Index", "account");
            routeBuilder.MapFallbackToController("admin/", "Index", "admin");

            // default root
            routeBuilder.MapControllerRoute(
                null,
                "/{page}",
                defaults: new { controller = "Home", action = "Index" }
                );

            routeBuilder.MapControllerRoute(
                name: "default",
                pattern: "{controller=Home}/{action=Index}/{id?}");


            return(routeBuilder);
        }
Esempio n. 3
0
        public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
        {
            var mediaFileProvider   = serviceProvider.GetRequiredService <IMediaFileProvider>();
            var mediaOptions        = serviceProvider.GetRequiredService <IOptions <MediaOptions> >().Value;
            var mediaFileStoreCache = serviceProvider.GetService <IMediaFileStoreCache>();

            // FileStore middleware before ImageSharp, but only if a remote storage module has registered a cache provider.
            if (mediaFileStoreCache != null)
            {
                app.UseMiddleware <MediaFileStoreResolverMiddleware>();
            }

            // ImageSharp before the static file provider.
            app.UseImageSharp();

            // Use the same cache control header as ImageSharp does for resized images.
            var cacheControl = "public, must-revalidate, max-age=" + TimeSpan.FromDays(mediaOptions.MaxBrowserCacheDays).TotalSeconds.ToString();

            app.UseStaticFiles(new StaticFileOptions
            {
                // The tenant's prefix is already implied by the infrastructure.
                RequestPath           = mediaOptions.AssetsRequestPath,
                FileProvider          = mediaFileProvider,
                ServeUnknownFileTypes = true,
                OnPrepareResponse     = ctx =>
                {
                    ctx.Context.Response.Headers[HeaderNames.CacheControl] = cacheControl;
                }
            });

            var adminControllerName = typeof(AdminController).ControllerName();

            routes.MapAreaControllerRoute(
                name: "Media.Index",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.Index) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.MediaApplication",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/MediaApplication",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.MediaApplication) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.GetFolders",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/GetFolders",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.GetFolders) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.GetMediaItems",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/GetMediaItems",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.GetMediaItems) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.GetMediaItem",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/GetMediaItem",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.GetMediaItem) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.Upload",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/Upload",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.Upload) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.DeleteFolder",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/DeleteFolder",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.DeleteFolder) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.DeleteMedia",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/DeleteMedia",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.DeleteMedia) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.MoveMedia",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/MoveMedia",
                defaults: new { controller = typeof(AdminController).ControllerName(), action = nameof(AdminController.MoveMedia) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.DeleteMediaList",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/DeleteMediaList",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.DeleteMediaList) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.MoveMediaList",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/MoveMediaList",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.MoveMediaList) }
                );

            routes.MapAreaControllerRoute(
                name: "Media.CreateFolder",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/Media/CreateFolder",
                defaults: new { controller = adminControllerName, action = nameof(AdminController.CreateFolder) }
                );

            var mediaCacheControllerName = typeof(MediaCacheController).ControllerName();

            routes.MapAreaControllerRoute(
                name: "MediaCache.Index",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/MediaCache",
                defaults: new { controller = mediaCacheControllerName, action = nameof(MediaCacheController.Index) }
                );

            routes.MapAreaControllerRoute(
                name: "MediaCache.Purge",
                areaName: "OrchardCore.Media",
                pattern: _adminOptions.AdminUrlPrefix + "/MediaCache/Purge",
                defaults: new { controller = mediaCacheControllerName, action = nameof(MediaCacheController.Purge) }
                );
        }
Esempio n. 4
0
 public static GrpcServiceEndpointConventionBuilder MapHttpReportsGrpcCollector(this IEndpointRouteBuilder builder)
 {
     return(builder.MapGrpcService <GrpcCollectorService>());
 }
 public static void AddDiscoveryGrpcServices(this IEndpointRouteBuilder endpoints)
 {
     endpoints.MapGrpcService <RegistrationService>();
     endpoints.MapGrpcService <ApplicationMonitorService>();
     endpoints.MapGrpcService <ApplicationDiscoveryService>();
 }
Esempio n. 6
0
        /// <summary>
        /// Register routes
        /// </summary>
        /// <param name="endpointRouteBuilder">Route builder</param>
        public void RegisterRoutes(IEndpointRouteBuilder endpointRouteBuilder)
        {
            var pattern = string.Empty;

            if (DataSettingsManager.DatabaseIsInstalled)
            {
                var localizationSettings = endpointRouteBuilder.ServiceProvider.GetRequiredService <LocalizationSettings>();
                if (localizationSettings.SeoFriendlyUrlsForLanguagesEnabled)
                {
                    var langservice = endpointRouteBuilder.ServiceProvider.GetRequiredService <ILanguageService>();
                    var languages   = langservice.GetAllLanguages().ToList();
                    pattern = "{language:lang=" + languages.FirstOrDefault().UniqueSeoCode + "}/";
                }
            }

            //areas
            endpointRouteBuilder.MapControllerRoute(name: "areaRoute",
                                                    pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");

            //home page
            endpointRouteBuilder.MapControllerRoute("Homepage", pattern,
                                                    new { controller = "Home", action = "Index" });

            //login
            endpointRouteBuilder.MapControllerRoute("Login", $"{pattern}login/",
                                                    new { controller = "Customer", action = "Login" });

            //register
            endpointRouteBuilder.MapControllerRoute("Register", $"{pattern}register/",
                                                    new { controller = "Customer", action = "Register" });

            //logout
            endpointRouteBuilder.MapControllerRoute("Logout", $"{pattern}logout/",
                                                    new { controller = "Customer", action = "Logout" });

            //shopping cart
            endpointRouteBuilder.MapControllerRoute("ShoppingCart", $"{pattern}cart/",
                                                    new { controller = "ShoppingCart", action = "Cart" });

            //estimate shipping
            endpointRouteBuilder.MapControllerRoute("EstimateShipping", $"{pattern}cart/estimateshipping",
                                                    new { controller = "ShoppingCart", action = "GetEstimateShipping" });

            //wishlist
            endpointRouteBuilder.MapControllerRoute("Wishlist", pattern + "wishlist/{customerGuid?}",
                                                    new { controller = "ShoppingCart", action = "Wishlist" });

            //customer account links
            endpointRouteBuilder.MapControllerRoute("CustomerInfo", $"{pattern}customer/info",
                                                    new { controller = "Customer", action = "Info" });

            endpointRouteBuilder.MapControllerRoute("CustomerAddresses", $"{pattern}customer/addresses",
                                                    new { controller = "Customer", action = "Addresses" });

            endpointRouteBuilder.MapControllerRoute("CustomerOrders", $"{pattern}order/history",
                                                    new { controller = "Order", action = "CustomerOrders" });

            //contact us
            endpointRouteBuilder.MapControllerRoute("ContactUs", $"{pattern}contactus",
                                                    new { controller = "Common", action = "ContactUs" });

            //sitemap
            endpointRouteBuilder.MapControllerRoute("Sitemap", $"{pattern}sitemap",
                                                    new { controller = "Common", action = "Sitemap" });

            //product search
            endpointRouteBuilder.MapControllerRoute("ProductSearch", $"{pattern}search/",
                                                    new { controller = "Catalog", action = "Search" });

            endpointRouteBuilder.MapControllerRoute("ProductSearchAutoComplete", $"{pattern}catalog/searchtermautocomplete",
                                                    new { controller = "Catalog", action = "SearchTermAutoComplete" });

            //change currency (AJAX link)
            endpointRouteBuilder.MapControllerRoute("ChangeCurrency", pattern + "changecurrency/{customercurrency:min(0)}",
                                                    new { controller = "Common", action = "SetCurrency" });

            //change language (AJAX link)
            endpointRouteBuilder.MapControllerRoute("ChangeLanguage", pattern + "changelanguage/{langid:min(0)}",
                                                    new { controller = "Common", action = "SetLanguage" });

            //change tax (AJAX link)
            endpointRouteBuilder.MapControllerRoute("ChangeTaxType", pattern + "changetaxtype/{customertaxtype:min(0)}",
                                                    new { controller = "Common", action = "SetTaxType" });

            //recently viewed products
            endpointRouteBuilder.MapControllerRoute("RecentlyViewedProducts", $"{pattern}recentlyviewedproducts/",
                                                    new { controller = "Product", action = "RecentlyViewedProducts" });

            //new products
            endpointRouteBuilder.MapControllerRoute("NewProducts", $"{pattern}newproducts/",
                                                    new { controller = "Product", action = "NewProducts" });

            //blog
            endpointRouteBuilder.MapControllerRoute("Blog", $"{pattern}blog",
                                                    new { controller = "Blog", action = "List" });

            //news
            endpointRouteBuilder.MapControllerRoute("NewsArchive", $"{pattern}news",
                                                    new { controller = "News", action = "List" });

            //forum
            endpointRouteBuilder.MapControllerRoute("Boards", $"{pattern}boards",
                                                    new { controller = "Boards", action = "Index" });

            //compare products
            endpointRouteBuilder.MapControllerRoute("CompareProducts", $"{pattern}compareproducts/",
                                                    new { controller = "Product", action = "CompareProducts" });

            //product tags
            endpointRouteBuilder.MapControllerRoute("ProductTagsAll", $"{pattern}producttag/all/",
                                                    new { controller = "Catalog", action = "ProductTagsAll" });

            //manufacturers
            endpointRouteBuilder.MapControllerRoute("ManufacturerList", $"{pattern}manufacturer/all/",
                                                    new { controller = "Catalog", action = "ManufacturerAll" });

            //vendors
            endpointRouteBuilder.MapControllerRoute("VendorList", $"{pattern}vendor/all/",
                                                    new { controller = "Catalog", action = "VendorAll" });

            //add product to cart (without any attributes and options). used on catalog pages.
            endpointRouteBuilder.MapControllerRoute("AddProductToCart-Catalog",
                                                    pattern + "addproducttocart/catalog/{productId:min(0)}/{shoppingCartTypeId:min(0)}/{quantity:min(0)}",
                                                    new { controller = "ShoppingCart", action = "AddProductToCart_Catalog" });

            //add product to cart (with attributes and options). used on the product details pages.
            endpointRouteBuilder.MapControllerRoute("AddProductToCart-Details",
                                                    pattern + "addproducttocart/details/{productId:min(0)}/{shoppingCartTypeId:min(0)}",
                                                    new { controller = "ShoppingCart", action = "AddProductToCart_Details" });

            //comparing products
            endpointRouteBuilder.MapControllerRoute("AddProductToCompare", "compareproducts/add/{productId:min(0)}",
                                                    new { controller = "Product", action = "AddProductToCompareList" });

            //product email a friend
            endpointRouteBuilder.MapControllerRoute("ProductEmailAFriend",
                                                    pattern + "productemailafriend/{productId:min(0)}",
                                                    new { controller = "Product", action = "ProductEmailAFriend" });

            //reviews
            endpointRouteBuilder.MapControllerRoute("ProductReviews2", pattern + "productreviews/{productId2}",
                                                    new { controller = "Product", action = "ProductReviews2" });

            endpointRouteBuilder.MapControllerRoute("ProductReviews", pattern + "productreviews/{productId}",
                                                    new { controller = "Product", action = "ProductReviews" });

            endpointRouteBuilder.MapControllerRoute("CustomerProductReviews", $"{pattern}customer/productreviews",
                                                    new { controller = "Product", action = "CustomerProductReviews" });

            endpointRouteBuilder.MapControllerRoute("CustomerProductReviewsPaged",
                                                    pattern + "customer/productreviews/page/{pageNumber:min(0)}",
                                                    new { controller = "Product", action = "CustomerProductReviews" });

            //back in stock notifications
            endpointRouteBuilder.MapControllerRoute("BackInStockSubscribePopup",
                                                    pattern + "backinstocksubscribe/{productId:min(0)}",
                                                    new { controller = "BackInStockSubscription", action = "SubscribePopup" });

            endpointRouteBuilder.MapControllerRoute("BackInStockSubscribeSend",
                                                    pattern + "backinstocksubscribesend/{productId:min(0)}",
                                                    new { controller = "BackInStockSubscription", action = "SubscribePopupPOST" });

            //downloads
            endpointRouteBuilder.MapControllerRoute("GetSampleDownload",
                                                    pattern + "download/sample/{productid:min(0)}",
                                                    new { controller = "Download", action = "Sample" });

            //checkout pages
            endpointRouteBuilder.MapControllerRoute("Checkout", $"{pattern}checkout/",
                                                    new { controller = "Checkout", action = "Index" });

            endpointRouteBuilder.MapControllerRoute("CheckoutOnePage", $"{pattern}onepagecheckout/",
                                                    new { controller = "Checkout", action = "OnePageCheckout" });

            endpointRouteBuilder.MapControllerRoute("CheckoutShippingAddress", $"{pattern}checkout/shippingaddress",
                                                    new { controller = "Checkout", action = "ShippingAddress" });

            endpointRouteBuilder.MapControllerRoute("CheckoutSelectShippingAddress", $"{pattern}checkout/selectshippingaddress",
                                                    new { controller = "Checkout", action = "SelectShippingAddress" });

            endpointRouteBuilder.MapControllerRoute("CheckoutBillingAddress", $"{pattern}checkout/billingaddress",
                                                    new { controller = "Checkout", action = "BillingAddress" });

            endpointRouteBuilder.MapControllerRoute("CheckoutSelectBillingAddress", $"{pattern}checkout/selectbillingaddress",
                                                    new { controller = "Checkout", action = "SelectBillingAddress" });

            endpointRouteBuilder.MapControllerRoute("CheckoutShippingMethod", $"{pattern}checkout/shippingmethod",
                                                    new { controller = "Checkout", action = "ShippingMethod" });

            endpointRouteBuilder.MapControllerRoute("CheckoutPaymentMethod", $"{pattern}checkout/paymentmethod",
                                                    new { controller = "Checkout", action = "PaymentMethod" });

            endpointRouteBuilder.MapControllerRoute("CheckoutPaymentInfo", $"{pattern}checkout/paymentinfo",
                                                    new { controller = "Checkout", action = "PaymentInfo" });

            endpointRouteBuilder.MapControllerRoute("CheckoutConfirm", $"{pattern}checkout/confirm",
                                                    new { controller = "Checkout", action = "Confirm" });

            endpointRouteBuilder.MapControllerRoute("CheckoutCompleted",
                                                    pattern + "checkout/completed/{orderId:int}",
                                                    new { controller = "Checkout", action = "Completed" });

            //subscribe newsletters
            endpointRouteBuilder.MapControllerRoute("SubscribeNewsletter", $"{pattern}subscribenewsletter",
                                                    new { controller = "Newsletter", action = "SubscribeNewsletter" });

            //email wishlist
            endpointRouteBuilder.MapControllerRoute("EmailWishlist", $"{pattern}emailwishlist",
                                                    new { controller = "ShoppingCart", action = "EmailWishlist" });

            //login page for checkout as guest
            endpointRouteBuilder.MapControllerRoute("LoginCheckoutAsGuest", $"{pattern}login/checkoutasguest",
                                                    new { controller = "Customer", action = "Login", checkoutAsGuest = true });

            //register result page
            endpointRouteBuilder.MapControllerRoute("RegisterResult",
                                                    pattern + "registerresult/{resultId:min(0)}",
                                                    new { controller = "Customer", action = "RegisterResult" });

            //check username availability
            endpointRouteBuilder.MapControllerRoute("CheckUsernameAvailability", $"{pattern}customer/checkusernameavailability",
                                                    new { controller = "Customer", action = "CheckUsernameAvailability" });

            //passwordrecovery
            endpointRouteBuilder.MapControllerRoute("PasswordRecovery", $"{pattern}passwordrecovery",
                                                    new { controller = "Customer", action = "PasswordRecovery" });

            //password recovery confirmation
            endpointRouteBuilder.MapControllerRoute("PasswordRecoveryConfirm", $"{pattern}passwordrecovery/confirm",
                                                    new { controller = "Customer", action = "PasswordRecoveryConfirm" });

            //topics
            endpointRouteBuilder.MapControllerRoute("TopicPopup",
                                                    pattern + "t-popup/{SystemName}",
                                                    new { controller = "Topic", action = "TopicDetailsPopup" });

            //blog
            endpointRouteBuilder.MapControllerRoute("BlogByTag",
                                                    pattern + "blog/tag/{tag}",
                                                    new { controller = "Blog", action = "BlogByTag" });

            endpointRouteBuilder.MapControllerRoute("BlogByMonth",
                                                    pattern + "blog/month/{month}",
                                                    new { controller = "Blog", action = "BlogByMonth" });

            //blog RSS
            endpointRouteBuilder.MapControllerRoute("BlogRSS",
                                                    pattern + "blog/rss/{languageId:min(0)}",
                                                    new { controller = "Blog", action = "ListRss" });

            //news RSS
            endpointRouteBuilder.MapControllerRoute("NewsRSS",
                                                    pattern + "news/rss/{languageId:min(0)}",
                                                    new { controller = "News", action = "ListRss" });

            //set review helpfulness (AJAX link)
            endpointRouteBuilder.MapControllerRoute("SetProductReviewHelpfulness", $"{pattern}setproductreviewhelpfulness",
                                                    new { controller = "Product", action = "SetProductReviewHelpfulness" });

            //customer account links
            endpointRouteBuilder.MapControllerRoute("CustomerReturnRequests", $"{pattern}returnrequest/history",
                                                    new { controller = "ReturnRequest", action = "CustomerReturnRequests" });

            endpointRouteBuilder.MapControllerRoute("CustomerDownloadableProducts", $"{pattern}customer/downloadableproducts",
                                                    new { controller = "Customer", action = "DownloadableProducts" });

            endpointRouteBuilder.MapControllerRoute("CustomerBackInStockSubscriptions",
                                                    pattern + "backinstocksubscriptions/manage/{pageNumber:int?}",
                                                    new { controller = "BackInStockSubscription", action = "CustomerSubscriptions" });

            endpointRouteBuilder.MapControllerRoute("CustomerRewardPoints", $"{pattern}rewardpoints/history",
                                                    new { controller = "Order", action = "CustomerRewardPoints" });

            endpointRouteBuilder.MapControllerRoute("CustomerRewardPointsPaged",
                                                    pattern + "rewardpoints/history/page/{pageNumber:min(0)}",
                                                    new { controller = "Order", action = "CustomerRewardPoints" });

            endpointRouteBuilder.MapControllerRoute("CustomerChangePassword", $"{pattern}customer/changepassword",
                                                    new { controller = "Customer", action = "ChangePassword" });

            endpointRouteBuilder.MapControllerRoute("CustomerAvatar", $"{pattern}customer/avatar",
                                                    new { controller = "Customer", action = "Avatar" });

            endpointRouteBuilder.MapControllerRoute("AccountActivation", $"{pattern}customer/activation",
                                                    new { controller = "Customer", action = "AccountActivation" });

            endpointRouteBuilder.MapControllerRoute("EmailRevalidation", $"{pattern}customer/revalidateemail",
                                                    new { controller = "Customer", action = "EmailRevalidation" });

            endpointRouteBuilder.MapControllerRoute("CustomerForumSubscriptions",
                                                    pattern + "boards/forumsubscriptions/{pageNumber:int?}",
                                                    new { controller = "Boards", action = "CustomerForumSubscriptions" });

            endpointRouteBuilder.MapControllerRoute("CustomerAddressEdit",
                                                    pattern + "customer/addressedit/{addressId:min(0)}",
                                                    new { controller = "Customer", action = "AddressEdit" });

            endpointRouteBuilder.MapControllerRoute("CustomerAddressAdd", $"{pattern}customer/addressadd",
                                                    new { controller = "Customer", action = "AddressAdd" });

            //customer profile page
            endpointRouteBuilder.MapControllerRoute("CustomerProfile",
                                                    pattern + "profile/{id:min(0)}",
                                                    new { controller = "Profile", action = "Index" });

            endpointRouteBuilder.MapControllerRoute("CustomerProfilePaged",
                                                    pattern + "profile/{id:min(0)}/page/{pageNumber:min(0)}",
                                                    new { controller = "Profile", action = "Index" });

            //orders
            endpointRouteBuilder.MapControllerRoute("OrderDetails",
                                                    pattern + "orderdetails/{orderId:min(0)}",
                                                    new { controller = "Order", action = "Details" });

            endpointRouteBuilder.MapControllerRoute("ShipmentDetails",
                                                    pattern + "orderdetails/shipment/{shipmentId}",
                                                    new { controller = "Order", action = "ShipmentDetails" });

            endpointRouteBuilder.MapControllerRoute("ReturnRequest",
                                                    pattern + "returnrequest/{orderId:min(0)}",
                                                    new { controller = "ReturnRequest", action = "ReturnRequest" });

            endpointRouteBuilder.MapControllerRoute("ReOrder",
                                                    pattern + "reorder/{orderId:min(0)}",
                                                    new { controller = "Order", action = "ReOrder" });

            endpointRouteBuilder.MapControllerRoute("GetOrderPdfInvoice",
                                                    pattern + "orderdetails/pdf/{orderId}",
                                                    new { controller = "Order", action = "GetPdfInvoice" });

            endpointRouteBuilder.MapControllerRoute("PrintOrderDetails",
                                                    pattern + "orderdetails/print/{orderId}",
                                                    new { controller = "Order", action = "PrintOrderDetails" });

            //order downloads
            endpointRouteBuilder.MapControllerRoute("GetDownload",
                                                    pattern + "download/getdownload/{orderItemId:guid}/{agree?}",
                                                    new { controller = "Download", action = "GetDownload" });

            endpointRouteBuilder.MapControllerRoute("GetLicense",
                                                    pattern + "download/getlicense/{orderItemId:guid}/",
                                                    new { controller = "Download", action = "GetLicense" });

            endpointRouteBuilder.MapControllerRoute("DownloadUserAgreement",
                                                    pattern + "customer/useragreement/{orderItemId:guid}",
                                                    new { controller = "Customer", action = "UserAgreement" });

            endpointRouteBuilder.MapControllerRoute("GetOrderNoteFile",
                                                    pattern + "download/ordernotefile/{ordernoteid:min(0)}",
                                                    new { controller = "Download", action = "GetOrderNoteFile" });

            //contact vendor
            endpointRouteBuilder.MapControllerRoute("ContactVendor",
                                                    pattern + "contactvendor/{vendorId}",
                                                    new { controller = "Common", action = "ContactVendor" });

            //apply for vendor account
            endpointRouteBuilder.MapControllerRoute("ApplyVendorAccount", $"{pattern}vendor/apply",
                                                    new { controller = "Vendor", action = "ApplyVendor" });

            //vendor info
            endpointRouteBuilder.MapControllerRoute("CustomerVendorInfo", $"{pattern}customer/vendorinfo",
                                                    new { controller = "Vendor", action = "Info" });

            //customer GDPR
            endpointRouteBuilder.MapControllerRoute("GdprTools", $"{pattern}customer/gdpr",
                                                    new { controller = "Customer", action = "GdprTools" });

            //customer check gift card balance
            endpointRouteBuilder.MapControllerRoute("CheckGiftCardBalance", $"{pattern}customer/checkgiftcardbalance",
                                                    new { controller = "Customer", action = "CheckGiftCardBalance" });

            //poll vote AJAX link
            endpointRouteBuilder.MapControllerRoute("PollVote", "poll/vote",
                                                    new { controller = "Poll", action = "Vote" });

            //comparing products
            endpointRouteBuilder.MapControllerRoute("RemoveProductFromCompareList",
                                                    pattern + "compareproducts/remove/{productId}",
                                                    new { controller = "Product", action = "RemoveProductFromCompareList" });

            endpointRouteBuilder.MapControllerRoute("ClearCompareList", $"{pattern}clearcomparelist/",
                                                    new { controller = "Product", action = "ClearCompareList" });

            //new RSS
            endpointRouteBuilder.MapControllerRoute("NewProductsRSS", $"{pattern}newproducts/rss",
                                                    new { controller = "Product", action = "NewProductsRss" });

            //get state list by country ID  (AJAX link)
            endpointRouteBuilder.MapControllerRoute("GetStatesByCountryId", $"{pattern}country/getstatesbycountryid/",
                                                    new { controller = "Country", action = "GetStatesByCountryId" });

            //EU Cookie law accept button handler (AJAX link)
            endpointRouteBuilder.MapControllerRoute("EuCookieLawAccept", $"{pattern}eucookielawaccept",
                                                    new { controller = "Common", action = "EuCookieLawAccept" });

            //authenticate topic AJAX link
            endpointRouteBuilder.MapControllerRoute("TopicAuthenticate", $"{pattern}topic/authenticate",
                                                    new { controller = "Topic", action = "Authenticate" });

            //prepare top menu (AJAX link)
            endpointRouteBuilder.MapControllerRoute("GetCatalogRoot", $"{pattern}catalog/getcatalogroot",
                                                    new { controller = "Catalog", action = "GetCatalogRoot" });

            endpointRouteBuilder.MapControllerRoute("GetCatalogSubCategories", $"{pattern}catalog/getcatalogsubcategories",
                                                    new { controller = "Catalog", action = "GetCatalogSubCategories" });

            //product attributes with "upload file" type
            endpointRouteBuilder.MapControllerRoute("UploadFileProductAttribute",
                                                    pattern + "uploadfileproductattribute/{attributeId:min(0)}",
                                                    new { controller = "ShoppingCart", action = "UploadFileProductAttribute" });

            //checkout attributes with "upload file" type
            endpointRouteBuilder.MapControllerRoute("UploadFileCheckoutAttribute",
                                                    pattern + "uploadfilecheckoutattribute/{attributeId:min(0)}",
                                                    new { controller = "ShoppingCart", action = "UploadFileCheckoutAttribute" });

            //return request with "upload file" support
            endpointRouteBuilder.MapControllerRoute("UploadFileReturnRequest", $"{pattern}uploadfilereturnrequest",
                                                    new { controller = "ReturnRequest", action = "UploadFileReturnRequest" });

            //forums
            endpointRouteBuilder.MapControllerRoute("ActiveDiscussions", $"{pattern}boards/activediscussions",
                                                    new { controller = "Boards", action = "ActiveDiscussions" });

            endpointRouteBuilder.MapControllerRoute("ActiveDiscussionsPaged",
                                                    pattern + "boards/activediscussions/page/{pageNumber:int}",
                                                    new { controller = "Boards", action = "ActiveDiscussions" });

            endpointRouteBuilder.MapControllerRoute("ActiveDiscussionsRSS", $"{pattern}boards/activediscussionsrss",
                                                    new { controller = "Boards", action = "ActiveDiscussionsRSS" });

            endpointRouteBuilder.MapControllerRoute("PostEdit",
                                                    pattern + "boards/postedit/{id:min(0)}",
                                                    new { controller = "Boards", action = "PostEdit" });

            endpointRouteBuilder.MapControllerRoute("PostDelete",
                                                    pattern + "boards/postdelete/{id:min(0)}",
                                                    new { controller = "Boards", action = "PostDelete" });

            endpointRouteBuilder.MapControllerRoute("PostCreate",
                                                    pattern + "boards/postcreate/{id:min(0)}",
                                                    new { controller = "Boards", action = "PostCreate" });

            endpointRouteBuilder.MapControllerRoute("PostCreateQuote",
                                                    pattern + "boards/postcreate/{id:min(0)}/{quote:min(0)}",
                                                    new { controller = "Boards", action = "PostCreate" });

            endpointRouteBuilder.MapControllerRoute("TopicEdit",
                                                    pattern + "boards/topicedit/{id:min(0)}",
                                                    new { controller = "Boards", action = "TopicEdit" });

            endpointRouteBuilder.MapControllerRoute("TopicDelete",
                                                    pattern + "boards/topicdelete/{id:min(0)}",
                                                    new { controller = "Boards", action = "TopicDelete" });

            endpointRouteBuilder.MapControllerRoute("TopicCreate",
                                                    pattern + "boards/topiccreate/{id:min(0)}",
                                                    new { controller = "Boards", action = "TopicCreate" });

            endpointRouteBuilder.MapControllerRoute("TopicMove",
                                                    pattern + "boards/topicmove/{id:min(0)}",
                                                    new { controller = "Boards", action = "TopicMove" });

            endpointRouteBuilder.MapControllerRoute("TopicWatch",
                                                    pattern + "boards/topicwatch/{id:min(0)}",
                                                    new { controller = "Boards", action = "TopicWatch" });

            endpointRouteBuilder.MapControllerRoute("TopicSlug",
                                                    pattern + "boards/topic/{id:min(0)}/{slug?}",
                                                    new { controller = "Boards", action = "Topic" });

            endpointRouteBuilder.MapControllerRoute("TopicSlugPaged",
                                                    pattern + "boards/topic/{id:min(0)}/{slug?}/page/{pageNumber:int}",
                                                    new { controller = "Boards", action = "Topic" });

            endpointRouteBuilder.MapControllerRoute("ForumWatch",
                                                    pattern + "boards/forumwatch/{id:min(0)}",
                                                    new { controller = "Boards", action = "ForumWatch" });

            endpointRouteBuilder.MapControllerRoute("ForumRSS",
                                                    pattern + "boards/forumrss/{id:min(0)}",
                                                    new { controller = "Boards", action = "ForumRSS" });

            endpointRouteBuilder.MapControllerRoute("ForumSlug",
                                                    pattern + "boards/forum/{id:min(0)}/{slug?}",
                                                    new { controller = "Boards", action = "Forum" });

            endpointRouteBuilder.MapControllerRoute("ForumSlugPaged",
                                                    pattern + "boards/forum/{id:min(0)}/{slug?}/page/{pageNumber:int}",
                                                    new { controller = "Boards", action = "Forum" });

            endpointRouteBuilder.MapControllerRoute("ForumGroupSlug",
                                                    pattern + "boards/forumgroup/{id:min(0)}/{slug?}",
                                                    new { controller = "Boards", action = "ForumGroup" });

            endpointRouteBuilder.MapControllerRoute("Search", $"{pattern}boards/search",
                                                    new { controller = "Boards", action = "Search" });

            //private messages
            endpointRouteBuilder.MapControllerRoute("PrivateMessages",
                                                    pattern + "privatemessages/{tab?}",
                                                    new { controller = "PrivateMessages", action = "Index" });

            endpointRouteBuilder.MapControllerRoute("PrivateMessagesPaged",
                                                    pattern + "privatemessages/{tab?}/page/{pageNumber:min(0)}",
                                                    new { controller = "PrivateMessages", action = "Index" });

            endpointRouteBuilder.MapControllerRoute("PrivateMessagesInbox", $"{pattern}inboxupdate",
                                                    new { controller = "PrivateMessages", action = "InboxUpdate" });

            endpointRouteBuilder.MapControllerRoute("PrivateMessagesSent", $"{pattern}sentupdate",
                                                    new { controller = "PrivateMessages", action = "SentUpdate" });

            endpointRouteBuilder.MapControllerRoute("SendPM",
                                                    pattern + "sendpm/{toCustomerId:min(0)}",
                                                    new { controller = "PrivateMessages", action = "SendPM" });

            endpointRouteBuilder.MapControllerRoute("SendPMReply",
                                                    pattern + "sendpm/{toCustomerId:min(0)}/{replyToMessageId:min(0)}",
                                                    new { controller = "PrivateMessages", action = "SendPM" });

            endpointRouteBuilder.MapControllerRoute("ViewPM",
                                                    pattern + "viewpm/{privateMessageId:min(0)}",
                                                    new { controller = "PrivateMessages", action = "ViewPM" });

            endpointRouteBuilder.MapControllerRoute("DeletePM",
                                                    pattern + "deletepm/{privateMessageId:min(0)}",
                                                    new { controller = "PrivateMessages", action = "DeletePM" });

            //activate newsletters
            endpointRouteBuilder.MapControllerRoute("NewsletterActivation",
                                                    pattern + "newsletter/subscriptionactivation/{token:guid}/{active}",
                                                    new { controller = "Newsletter", action = "SubscriptionActivation" });

            //robots.txt
            endpointRouteBuilder.MapControllerRoute("robots.txt", $"{pattern}robots.txt",
                                                    new { controller = "Common", action = "RobotsTextFile" });

            //sitemap (XML)
            endpointRouteBuilder.MapControllerRoute("sitemap.xml", $"{pattern}sitemap.xml",
                                                    new { controller = "Common", action = "SitemapXml" });

            endpointRouteBuilder.MapControllerRoute("sitemap-indexed.xml",
                                                    pattern + "sitemap-{Id:min(0)}.xml",
                                                    new { controller = "Common", action = "SitemapXml" });

            //store closed
            endpointRouteBuilder.MapControllerRoute("StoreClosed", $"{pattern}storeclosed",
                                                    new { controller = "Common", action = "StoreClosed" });

            //install
            endpointRouteBuilder.MapControllerRoute("Installation", $"{pattern}install",
                                                    new { controller = "Install", action = "Index" });

            //error page
            endpointRouteBuilder.MapControllerRoute("Error", "error",
                                                    new { controller = "Common", action = "Error" });

            //page not found
            endpointRouteBuilder.MapControllerRoute("PageNotFound", $"{pattern}page-not-found",
                                                    new { controller = "Common", action = "PageNotFound" });
        }
 private ModelEndpointDataSource GetBuilderEndpointDataSource(IEndpointRouteBuilder endpointRouteBuilder)
 {
     return(Assert.IsType <ModelEndpointDataSource>(Assert.Single(endpointRouteBuilder.DataSources)));
 }
Esempio n. 8
0
        public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
        {
            // Menu
            var menuControllerName = typeof(MenuController).ControllerName();

            routes.MapAreaControllerRoute(
                name: "AdminMenuList",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/List",
                defaults: new { controller = menuControllerName, action = nameof(MenuController.List) }
                );
            routes.MapAreaControllerRoute(
                name: "AdminMenuCreate",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Create",
                defaults: new { controller = menuControllerName, action = nameof(MenuController.Create) }
                );
            routes.MapAreaControllerRoute(
                name: "AdminMenuDelete",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Delete/{id}",
                defaults: new { controller = menuControllerName, action = nameof(MenuController.Delete) }
                );
            routes.MapAreaControllerRoute(
                name: "AdminMenuEdit",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Edit/{id}",
                defaults: new { controller = menuControllerName, action = nameof(MenuController.Edit) }
                );
            routes.MapAreaControllerRoute(
                name: "AdminMenuToggle",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Toggle/{id}",
                defaults: new { controller = menuControllerName, action = nameof(MenuController.Toggle) }
                );

            // Node
            var nodeControllerName = typeof(NodeController).ControllerName();

            routes.MapAreaControllerRoute(
                name: "AdminMenuNodeList",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Node/List",
                defaults: new { controller = nodeControllerName, action = nameof(NodeController.List) }
                );
            routes.MapAreaControllerRoute(
                name: "AdminMenuNodeCreate",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Node/Create",
                defaults: new { controller = nodeControllerName, action = nameof(NodeController.Create) }
                );
            routes.MapAreaControllerRoute(
                name: "AdminMenuNodeDelete",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Node/Delete",
                defaults: new { controller = nodeControllerName, action = nameof(NodeController.Delete) }
                );
            routes.MapAreaControllerRoute(
                name: "AdminMenuNodeEdit",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Node/Edit",
                defaults: new { controller = nodeControllerName, action = nameof(NodeController.Edit) }
                );
            routes.MapAreaControllerRoute(
                name: "AdminMenuNodeToggle",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Node/Toggle",
                defaults: new { controller = nodeControllerName, action = nameof(NodeController.Toggle) }
                );
            routes.MapAreaControllerRoute(
                name: "AdminMenuNodeMoveNode",
                areaName: "OrchardCore.AdminMenu",
                pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/Node/MoveNode",
                defaults: new { controller = nodeControllerName, action = nameof(NodeController.MoveNode) }
                );
        }
Esempio n. 9
0
 protected virtual void MapOtherEndpoints(IEndpointRouteBuilder endpoints)
 {
 }
Esempio n. 10
0
 /// <summary>
 /// Maps discovered gRPC service implementations for the specified <see cref="EndpointVisibility"/>.
 /// </summary>
 /// <param name="endpoints">The endpoint route builder to map services to.</param>
 /// <param name="visibility">The endpoint visibility to map services for.</param>
 public static void MapDiscoveredGrpcServicesOf(this IEndpointRouteBuilder endpoints, EndpointVisibility visibility)
 => endpoints
 .ServiceProvider.GetRequiredService <ICanConfigureGrpcServicesForEndpoint>()
 .MapServicesForVisibility(endpoints, visibility);
Esempio n. 11
0
 public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
 {
 }
 /// <summary>
 /// Initializes the EndPoints using the registered EndPointInitializers
 /// </summary>
 /// <param name="endpointRouteBuilder">the EndpointBuilder that is used to configure the endpoints</param>
 public void MapEndPoints(IEndpointRouteBuilder endpointRouteBuilder)
 {
     endPointInitializers.ForEach(n => n.MapEndPoints(endpointRouteBuilder));
 }
 public static IEndpointConventionBuilder MapDbMigrationResultLongPolls
     (this IEndpointRouteBuilder endpoints, String pattern) =>
 endpoints.Map(pattern, HandleDbMigrationResultLongPolls).WithoutDbMigration();
Esempio n. 14
0
 public static void Register(IEndpointRouteBuilder route)
 {
     route.MapHub <AppHub>("/apps/hub");
 }
    /// <summary>
    /// Maps incoming requests with the specified path to the provided connection pipeline.
    /// </summary>
    /// <typeparam name="TConnectionHandler">The <see cref="ConnectionHandler"/> type.</typeparam>
    /// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
    /// <param name="pattern">The route pattern.</param>
    /// <param name="configureOptions">A callback to configure dispatcher options.</param>
    /// <returns>An <see cref="ConnectionEndpointRouteBuilder"/> for endpoints associated with the connections.</returns>
    public static ConnectionEndpointRouteBuilder MapConnectionHandler <TConnectionHandler>(this IEndpointRouteBuilder endpoints, string pattern, Action <HttpConnectionDispatcherOptions>?configureOptions) where TConnectionHandler : ConnectionHandler
    {
        var options = new HttpConnectionDispatcherOptions();

        configureOptions?.Invoke(options);

        var conventionBuilder = endpoints.MapConnections(pattern, options, b =>
        {
            b.UseConnectionHandler <TConnectionHandler>();
        });

        var attributes = typeof(TConnectionHandler).GetCustomAttributes(inherit: true);

        conventionBuilder.Add(e =>
        {
            // Add all attributes on the ConnectionHandler has metadata (this will allow for things like)
            // auth attributes and cors attributes to work seamlessly
            foreach (var item in attributes)
            {
                e.Metadata.Add(item);
            }
        });

        return(conventionBuilder);
    }
Esempio n. 16
0
 public void Execute(IEndpointRouteBuilder endpointRouteBuilder, IServiceProvider serviceProvider)
 {
     //endpointRouteBuilder.MapControllerRoute(name: "Module CMS", pattern: "", defaults: new { controller = "ModuleCMS", action = "Index" });
     endpointRouteBuilder.MapControllerRoute(name: "Module Core API", pattern: "{controller}/{action}", defaults: new { controller = "Default", action = "Index" });
 }
Esempio n. 17
0
 public void Execute(IEndpointRouteBuilder endpointRouteBuilder, IServiceProvider serviceProvider)
 {
     endpointRouteBuilder.MapControllerRoute(name: "Default", pattern: "modules/{controller}/{action}", defaults: new { controller = "Default", action = "Index" });
 }
        /// <summary>
        /// Adds a the <see cref="QueryCoordinator" /> <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/>.
        /// </summary>
        /// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
        /// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
        public static IEndpointConventionBuilder MapDolittleQueryCoordinator(this IEndpointRouteBuilder endpoints)
        {
            var queryCoordinator = endpoints.ServiceProvider.GetRequiredService <QueryCoordinator>();

            return(endpoints.MapPost("/api/Dolittle/Queries", queryCoordinator.Handle));
        }
        public static void Register(IEndpointRouteBuilder route)
#endif
        {
            route.MapHub <PaymentRequestHub>("/payment-requests/hub");
        }
Esempio n. 20
0
 public override void MapGrpcService(IEndpointRouteBuilder endpointRoute)
 {
     endpointRoute.MapGrpcService <DefaultHealthCheckService>();
 }
 private RouteEndpointBuilder GetRouteEndpointBuilder(IEndpointRouteBuilder endpointRouteBuilder)
 {
     return(Assert.IsType <RouteEndpointBuilder>(Assert.Single(GetBuilderEndpointDataSource(endpointRouteBuilder).EndpointBuilders)));
 }
Esempio n. 22
0
 /// <summary>
 /// Adds a route to the route builder with the specified name and template
 /// </summary>
 /// <param name="routeBuilder">The route builder to add the route to</param>
 /// <param name="name">The name of the route</param>
 /// <param name="template">The URL pattern of the route</param>
 /// <returns>Route builder</returns>
 public static IEndpointRouteBuilder MapGenericPathEndpoint(this IEndpointRouteBuilder routeBuilder, string name, string template)
 {
     return(MapGenericPathEndpoint(routeBuilder, name, template, defaults: null));
 }
Esempio n. 23
0
 /// <summary>
 /// Adds a specialized <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that will
 /// attempt to select a page using the route values produced by <typeparamref name="TTransformer"/>.
 /// </summary>
 /// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
 /// <param name="pattern">The URL pattern of the route.</param>
 /// <typeparam name="TTransformer">The type of a <see cref="DynamicRouteValueTransformer"/>.</typeparam>
 /// <remarks>
 /// <para>
 /// This method allows the registration of a <see cref="RouteEndpoint"/> and <see cref="DynamicRouteValueTransformer"/>
 /// that combine to dynamically select a page using custom logic.
 /// </para>
 /// <para>
 /// The instance of <typeparamref name="TTransformer"/> will be retrieved from the dependency injection container.
 /// Register <typeparamref name="TTransformer"/> with the desired service lifetime in <c>ConfigureServices</c>.
 /// </para>
 /// </remarks>
 public static void MapDynamicPageRoute <TTransformer>(this IEndpointRouteBuilder endpoints, string pattern)
     where TTransformer : DynamicRouteValueTransformer
 {
     MapDynamicPageRoute <TTransformer>(endpoints, pattern, state: null);
 }
Esempio n. 24
0
 /// <summary>
 /// Adds a route to the route builder with the specified name, template, default values, and constraints.
 /// </summary>
 /// <param name="routeBuilder">The route builder to add the route to</param>
 /// <param name="name">The name of the route</param>
 /// <param name="template">The URL pattern of the route</param>
 /// <param name="defaults"> An object that contains default values for route parameters.
 /// The object's properties represent the names and values of the default values</param>
 /// <param name="constraints">An object that contains constraints for the route.
 /// The object's properties represent the names and values of the constraints</param>
 /// <returns>Route builder</returns>
 public static IEndpointRouteBuilder MapGenericPathEndpoint(this IEndpointRouteBuilder routeBuilder,
                                                            string name, string template, object defaults, object constraints)
 {
     return(MapGenericPathEndpoint(routeBuilder, name, template, defaults, constraints, dataTokens: null));
 }
Esempio n. 25
0
        public static void UsePurchaseOrders(this IEndpointRouteBuilder builder,
                                             PurchaseOrderRepository purchaseOrders)
        {
            builder
            .MapGet(string.Empty, async context => {
                var orders = await purchaseOrders.List(context.RequestAborted);

                return(new HalResponse(context.Request, PurchaseOrderListRepresentation.Instance,
                                       ETag.Create(orders.Max(x => x.Position)), new Optional <object>(orders)));
            })
            .MapPost(string.Empty, async(HttpContext context, PurchaseOrder purchaseOrder) => {
                if (purchaseOrder.PurchaseOrderId == Guid.Empty)
                {
                    purchaseOrder.PurchaseOrderId = Guid.NewGuid();
                }

                await purchaseOrders.Save(purchaseOrder, context.RequestAborted);

                return(new HalResponse(context.Request, PurchaseOrderRepresentation.Instance,
                                       ETag.Create(purchaseOrder.Version), purchaseOrder)
                {
                    StatusCode = HttpStatusCode.Created,
                    Headers =
                    {
                        Location = new Uri(purchaseOrder.PurchaseOrderId.ToString())
                    }
                });
            })
            .MapGet("{purchaseOrderId:guid}", async context => {
                if (!context.TryParseGuid(nameof(PurchaseOrder.PurchaseOrderId), out var purchaseOrderId))
                {
                    return(new HalResponse(context.Request, PurchaseOrderRepresentation.Instance)
                    {
                        StatusCode = HttpStatusCode.NotFound
                    });
                }

                var order = await purchaseOrders.Get(purchaseOrderId, context.RequestAborted);

                return(new HalResponse(context.Request, PurchaseOrderRepresentation.Instance,
                                       ETag.Create(order.HasValue ? order.Value.Position : new long?()), order)
                {
                    StatusCode = order.HasValue ? HttpStatusCode.OK : HttpStatusCode.NotFound
                });
            })
            .MapPut("{purchaseOrderId:guid}", async(HttpContext context, PurchaseOrder purchaseOrder) => {
                if (!context.TryParseGuid(nameof(purchaseOrder.PurchaseOrderId), out var purchaseOrderId))
                {
                    return(new HalResponse(context.Request, PurchaseOrderRepresentation.Instance)
                    {
                        StatusCode = HttpStatusCode.NotFound
                    });
                }

                purchaseOrder.PurchaseOrderId = purchaseOrderId;

                await purchaseOrders.Save(purchaseOrder, context.RequestAborted);

                return(new HalResponse(context.Request, PurchaseOrderRepresentation.Instance,
                                       ETag.Create(purchaseOrder.Version), purchaseOrder));
            })
            .MapBusinessTransaction <PurchaseOrder>("{purchaseOrderId:guid}");
        }
 /// <summary>
 /// Maps incoming requests with the specified path to the provided connection pipeline.
 /// </summary>
 /// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
 /// <param name="pattern">The route pattern.</param>
 /// <param name="configure">A callback to configure the connection.</param>
 /// <returns>An <see cref="ConnectionEndpointRouteBuilder"/> for endpoints associated with the connections.</returns>
 public static ConnectionEndpointRouteBuilder MapConnections(this IEndpointRouteBuilder endpoints, string pattern, Action <IConnectionBuilder> configure) =>
 endpoints.MapConnections(pattern, new HttpConnectionDispatcherOptions(), configure);
Esempio n. 27
0
 public void Execute(IEndpointRouteBuilder endpointRouteBuilder, IServiceProvider serviceProvider)
 {
     endpointRouteBuilder.MapControllerRoute(name: "Backend Create", pattern: "{area:exists}/{controller=Default}/create", defaults: new { action = "CreateOrEdit" });
     endpointRouteBuilder.MapControllerRoute(name: "Backend Edit", pattern: "{area:exists}/{controller=Default}/edit/{id}", defaults: new { action = "CreateOrEdit" });
     endpointRouteBuilder.MapControllerRoute(name: "Backend Default", pattern: "{area:exists}/{controller=Default}/{action=Index}/{id?}");
 }
 /// <summary>
 /// Maps incoming requests with the specified path to the provided connection pipeline.
 /// </summary>
 /// <typeparam name="TConnectionHandler">The <see cref="ConnectionHandler"/> type.</typeparam>
 /// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
 /// <param name="pattern">The route pattern.</param>
 /// <returns>An <see cref="ConnectionEndpointRouteBuilder"/> for endpoints associated with the connections.</returns>
 public static ConnectionEndpointRouteBuilder MapConnectionHandler <TConnectionHandler>(this IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : ConnectionHandler
 {
     return(endpoints.MapConnectionHandler <TConnectionHandler>(pattern, configureOptions: null));
 }
Esempio n. 29
0
        public static IEndpointRouteBuilder MapSaHealthChecks(this IEndpointRouteBuilder endpoints)
        {
            // do stuff

            return(endpoints);
        }
 public EndpointBuilder(IEndpointRouteBuilder routeBuilder)
 {
     _routeBuilder = routeBuilder;
 }