using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; using Volo.Abp.Autofac; using Volo.Abp.Modularity; using Volo.Abp.TestApp.Domain; using Volo.Abp.AutoMapper; using Volo.Abp.TestApp.Application.Dto; namespace Volo.Abp.TestApp { [DependsOn( typeof(AbpDddApplicationModule), typeof(AbpAutofacModule), typeof(AbpTestBaseModule), typeof(AbpAutoMapperModule) )] public class TestAppModule : AbpModule { public override void ConfigureServices(IServiceCollection services) { ConfigureAutoMapper(services); services.AddAssemblyOf(); } public override void OnApplicationInitialization(ApplicationInitializationContext context) { SeedTestData(context); } private static void ConfigureAutoMapper(IServiceCollection services) { services.Configure(options => { options.Configurators.Add(ctx => { ctx.MapperConfiguration.CreateMap().ReverseMap(); ctx.MapperConfiguration.CreateMap().ReverseMap(); }); }); } private static void SeedTestData(ApplicationInitializationContext context) { using (var scope = context.ServiceProvider.CreateScope()) { scope.ServiceProvider .GetRequiredService() .Build(); } } } }