using System.Collections.Generic; using Bit.Core.Repositories.EntityFramework; using Bit.Core.Settings; using Bit.Test.Common.Helpers.Factories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; namespace Bit.Core.Test.Helpers.Factories { public static class DatabaseOptionsFactory { public static List> Options { get; } = new List>(); static DatabaseOptionsFactory() { var globalSettings = GlobalSettingsFactory.GlobalSettings; if (!string.IsNullOrWhiteSpace(GlobalSettingsFactory.GlobalSettings.PostgreSql?.ConnectionString)) { Options.Add(new DbContextOptionsBuilder().UseNpgsql(globalSettings.PostgreSql.ConnectionString).Options); } if (!string.IsNullOrWhiteSpace(GlobalSettingsFactory.GlobalSettings.MySql?.ConnectionString)) { var mySqlConnectionString = globalSettings.MySql.ConnectionString; Options.Add(new DbContextOptionsBuilder().UseMySql(mySqlConnectionString, ServerVersion.AutoDetect(mySqlConnectionString)).Options); } } } }