Use the configuration depending on the selected database provider #13
@@ -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;
 | 
					using Mirea.Api.Endpoint.Configuration.General.Interfaces;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Mirea.Api.Endpoint.Configuration.General.Settings;
 | 
					namespace Mirea.Api.Endpoint.Configuration.General.Settings;
 | 
				
			||||||
@@ -15,8 +17,15 @@ public class DbSettings : IIsConfigured
 | 
				
			|||||||
    public DatabaseEnum TypeDatabase { get; set; }
 | 
					    public DatabaseEnum TypeDatabase { get; set; }
 | 
				
			||||||
    public required string ConnectionStringSql { get; set; }
 | 
					    public required string ConnectionStringSql { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public bool IsConfigured()
 | 
					    public DatabaseProvider DatabaseProvider =>
 | 
				
			||||||
 | 
					        TypeDatabase switch
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
        return !string.IsNullOrEmpty(ConnectionStringSql);
 | 
					            DatabaseEnum.PostgresSql => DatabaseProvider.Postgresql,
 | 
				
			||||||
    }
 | 
					            DatabaseEnum.Mysql => DatabaseProvider.Mysql,
 | 
				
			||||||
 | 
					            DatabaseEnum.Sqlite => DatabaseProvider.Sqlite,
 | 
				
			||||||
 | 
					            _ => throw new ArgumentOutOfRangeException()
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public bool IsConfigured() =>
 | 
				
			||||||
 | 
					        !string.IsNullOrEmpty(ConnectionStringSql);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user