diff --git a/Endpoint/Configuration/General/Settings/DbSettings.cs b/Endpoint/Configuration/General/Settings/DbSettings.cs index f8ae35e..2fa5ff9 100644 --- a/Endpoint/Configuration/General/Settings/DbSettings.cs +++ b/Endpoint/Configuration/General/Settings/DbSettings.cs @@ -1,4 +1,6 @@ -using Mirea.Api.Endpoint.Configuration.General.Attributes; +using System; +using Mirea.Api.DataAccess.Persistence.Common; +using Mirea.Api.Endpoint.Configuration.General.Attributes; using Mirea.Api.Endpoint.Configuration.General.Interfaces; namespace Mirea.Api.Endpoint.Configuration.General.Settings; @@ -15,8 +17,15 @@ public class DbSettings : IIsConfigured public DatabaseEnum TypeDatabase { get; set; } public required string ConnectionStringSql { get; set; } - public bool IsConfigured() - { - return !string.IsNullOrEmpty(ConnectionStringSql); - } + public DatabaseProvider DatabaseProvider => + TypeDatabase switch + { + DatabaseEnum.PostgresSql => DatabaseProvider.Postgresql, + DatabaseEnum.Mysql => DatabaseProvider.Mysql, + DatabaseEnum.Sqlite => DatabaseProvider.Sqlite, + _ => throw new ArgumentOutOfRangeException() + }; + + public bool IsConfigured() => + !string.IsNullOrEmpty(ConnectionStringSql); } \ No newline at end of file