using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Identity; using Volo.Abp.Identity.AspNetCore; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.EntityFrameworkCore; namespace Volo.Abp.Account { [DependsOn( typeof(AbpIdentityAspNetCoreModule), typeof(AbpAccountApplicationModule), typeof(AbpIdentityDomainTestModule) )] public class AbpAccountApplicationTestModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { var sqliteConnection = CreateDatabaseAndGetConnection(); Configure(options => { options.Configure(abpDbContextConfigurationContext => { abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); }); }); } private static SqliteConnection CreateDatabaseAndGetConnection() { var connection = new SqliteConnection("Data Source=:memory:"); connection.Open(); new IdentityDbContext( new DbContextOptionsBuilder().UseSqlite(connection).Options ).GetService().CreateTables(); new PermissionManagementDbContext( new DbContextOptionsBuilder().UseSqlite(connection).Options ).GetService().CreateTables(); return connection; } } }