using FluentValidation; using Microsoft.Extensions.DependencyInjection; using System.Reflection; using zero.Core.Api; using zero.Core.Attributes; using zero.Core.Entities; using zero.Core.Extensions; using zero.Core.Options; using zero.Core.Plugins; using zero.Core.Renderer; using zero.Web.Mapper; using zero.Web.Sections; namespace zero.Web.Defaults { internal class ZeroBackofficePlugin : IZeroPlugin { public void ConfigureServices(IServiceCollection services) { services.AddAll(typeof(IValidator<>), ServiceLifetime.Scoped); services.AddAll(typeof(IValidator), ServiceLifetime.Scoped); services.AddAll(typeof(IRenderer<>), ServiceLifetime.Scoped); services.AddAll(typeof(IRenderer), ServiceLifetime.Scoped); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(typeof(IApplicationsApi<>), typeof(ApplicationsApi<>)); services.AddTransient(typeof(ICountriesApi<>), typeof(CountriesApi<>)); services.AddTransient(typeof(ILanguagesApi<>), typeof(LanguagesApi<>)); services.AddTransient(typeof(ITranslationsApi), typeof(TranslationsApi)); services.AddTransient(typeof(ITranslationsApi<>), typeof(TranslationsApi<>)); services.AddTransient(typeof(ITranslationsApiFacade), typeof(TranslationsApiFacade)); services.AddTransient(typeof(IPagesApi<>), typeof(PagesApi<>)); services.AddTransient(typeof(IPageTreeApi<>), typeof(PageTreeApi<>)); 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(); } public void Configure(IZeroPluginOptions plugin, IZeroOptions zero) { plugin.Name = "zero.Defaults"; plugin.LocalizationPaths.Add("~/Resources/Localization/zero.{lang}.json"); zero.Sections.Add(); zero.Sections.Add(); zero.Sections.Add(); zero.Sections.Add(); zero.Sections.Add(); zero.Settings.AddGroup(); zero.Settings.AddGroup(); zero.Mapper.Add(); zero.Mapper.Add(); zero.Mapper.Add(); zero.Mapper.Add(); zero.Mapper.Add(); zero.Mapper.Add(); zero.Mapper.Add(); } } }