/// <summary>
        /// Use area folders with custom options
        /// </summary>
        public static IMvcBuilder AddFlatAreas(this IMvcBuilder services, FlatAreaOptions options)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }
            if (options == null)
            {
                throw new ArgumentException(nameof(options));
            }

            var expander = new FlatAreaExpander(options);

            services.AddMvcOptions(o =>
            {
                o.Conventions.Add(new FlatAreaConvention(options));
            })
            .AddRazorOptions(o =>
            {
                // Accommodates the '_Base' folder name

                o.ViewLocationFormats.Clear();
                o.ViewLocationFormats.Add(options.AreaPlaceholder + @"\{0}.cshtml");
                o.ViewLocationFormats.Add(options.RootFolderName + @"\_Base\{0}.cshtml");
                o.ViewLocationExpanders.Add(expander);
            });

            return(services);
        }
 public FlatAreaExpander(FlatAreaOptions options)
 {
     _placeholder = options.AreaPlaceholder;
 }
 public FlatAreaConvention(FlatAreaOptions options)
 {
     _folderName             = options.RootFolderName;
     _nameDerivationStrategy = options.DeriveFolderName ?? DeriveAreaFolderName;
 }