34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Microsoft.Extensions.Configuration;
 | |
| 
 | |
| namespace Core.Cerberos.Infraestructure.Contexts.Mongo
 | |
| {
 | |
|     public class ConnectionStringProvider(IConfiguration configuration) : IConnectionStringProvider
 | |
|     {
 | |
|         public string ConnectionString { get; set; } = string.Empty;
 | |
|         public string Databasename { get; set; } = string.Empty;
 | |
|         public string Audience { get; set; } = string.Empty;
 | |
| 
 | |
|         public string GetConnectionString()
 | |
|         {
 | |
|             return configuration?.GetConnectionString("DefaultConnection")?.ToString() ?? string.Empty;
 | |
|         }
 | |
|         public string GetDatabasename()
 | |
|         {
 | |
|             return configuration.GetSection("MongoDb:DatabaseName").Value ?? string.Empty;
 | |
|         }
 | |
| 
 | |
|         public string GetAudience()
 | |
|         {
 | |
|             return configuration.GetSection("MongoDb:Audience").Value ?? string.Empty;
 | |
|         }
 | |
|     }
 | |
|     public interface IConnectionStringProvider
 | |
|     {
 | |
|         string GetConnectionString();
 | |
|         string GetDatabasename();
 | |
|         string ConnectionString { get; set; }
 | |
|         string Databasename { get; set; }
 | |
|         string Audience { get; set; }
 | |
|     }
 | |
| }
 | 
