Example #1
0
        public void Execute(IRouteBuilder routeBuilder, IServiceProvider serviceProvider)
        {
            var configuration  = serviceProvider.GetService <IConfiguration>();
            var backendOptions = new BackendOptions();

            configuration.Bind("Tapas:Backend", backendOptions);

            string routePrefix = DetermineRoutePrefix(backendOptions);

            routeBuilder.MapAreaRoute("BackendDefault",
                                      "Backend",
                                      routePrefix + "{controller=Home}/{action=Index}/{id?}");
        }
Example #2
0
        private static string DetermineRoutePrefix(BackendOptions options)
        {
            string routePrefix;

            if (options == null)
            {
                routePrefix = "backend/";
            }
            else if (options.RoutePrefix.IsNullOrWhiteSpace())
            {
                routePrefix = string.Empty;
            }
            else
            {
                routePrefix = options.RoutePrefix + "/";
            }

            return(routePrefix);
        }
 public BackendController(IOptions <BackendOptions> options)
 {
     _options = options.Value;
 }