using FluentValidation; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using zero.Core; using zero.Core.Api; using zero.Core.Blueprints; using zero.Core.Collections; using zero.Core.Entities; using zero.Core.Integrations; using zero.Core.Mails; using zero.Core.Messages; using zero.Core.Options; using zero.Core.Plugins; using zero.Core.Renderer; using zero.Core.Routing; using zero.Core.Services; using zero.Core.Tokens; using zero.Core.Validation; using zero.Web.Sections; using zero.Web.ViewHelpers; namespace zero.Web.Defaults { internal class ZeroBackofficePlugin : ZeroPlugin { public ZeroBackofficePlugin() { Options.Name = "zero.Defaults"; Options.LocalizationPaths.Add("~/Resources/Localization/zero.{lang}.json"); } public override void Configure(IZeroOptions zero) { zero.Sections.Add(); zero.Sections.Add(); zero.Sections.Add(); zero.Sections.Add(); zero.Sections.Add(); zero.Settings.AddGroup(); zero.Settings.AddGroup(); zero.Permissions.AddCollection(); zero.Permissions.AddCollection(); zero.Permissions.AddCollection(); zero.Permissions.AddCollection(); zero.Icons.AddSet("feather", "Feather", "/assets/icons/feather.svg", "fth"); zero.Pages.Add(Constants.Pages.FolderAlias, "@page.folder.name", "@page.folder.description", "fth-folder"); zero.Interceptors.Add(gravity: 100); zero.Interceptors.Add(gravity: -1); } public override void ConfigureServices(IServiceCollection services, IConfiguration configuration) { //services.AddAll(typeof(IValidator<>), ServiceLifetime.Scoped); //services.AddAll(typeof(IValidator), ServiceLifetime.Scoped); services.AddSingleton(); services.AddScoped(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient, ApplicationValidator>(); services.AddTransient, CountryValidator>(); services.AddTransient, MailTemplateValidator>(); services.AddTransient, LanguageValidator>(); services.AddTransient, TranslationValidator>(); services.AddTransient, PageValidator>(); services.AddTransient, MediaValidator>(); services.AddTransient, MediaFolderValidator>(); services.AddTransient, UserRoleValidator>(); services.AddTransient, BackofficeUserValidator>(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.TryAddEnumerable(ServiceDescriptor.Singleton()); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddTransient(); services.AddTransient(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); } } }