private string GetDbConnectionString(string keyName) { var connectionString = string.Empty; if (ConnectionStringConfig.ContainsKey(keyName) && !string.IsNullOrEmpty(ConnectionStringConfig[keyName])) { connectionString = ConnectionStringConfig[keyName]; } else { var hostUri = GetHostUri(); if (DatabaseConfig.MultiTenant != null && DatabaseConfig.MultiTenant.Database != null && (DatabaseConfig.MultiTenant.Database.ConfigFromDb || DatabaseConfig.MultiTenant.Database.HostUriConnectionMappings.Count > 0)) { var clientConfig = new Dictionary <string, string>(); if (DatabaseConfig.MultiTenant.Database.HostUriConnectionMappings.Count > 0 && DatabaseConfig.MultiTenant.Database.HostUriConnectionMappings.ContainsKey(hostUri)) { clientConfig = DatabaseConfig.MultiTenant.Database.HostUriConnectionMappings[hostUri]; } else { clientConfig = TenantDbConnection.GetAsync(hostUri).Result; } if (clientConfig != null && clientConfig.ContainsKey(keyName)) { connectionString = clientConfig[keyName]; } } } return(connectionString); }
private string GetDbConnectionString(string keyName) { var connectionString = string.Empty; if (ConnectionStringConfig.ContainsKey(keyName) && !string.IsNullOrEmpty(ConnectionStringConfig[keyName])) { connectionString = ConnectionStringConfig[keyName]; } else { var hostUri = GetHostUri(); var clientConfig = TenantDbConnection.GetAsync(hostUri).Result; if (clientConfig != null && clientConfig.ContainsKey(keyName)) { connectionString = clientConfig[keyName]; } } return(connectionString); }
private string GetDbConnectionString(string keyName) { var connectionString = string.Empty; if (ConnectionStringConfig.ContainsKey(keyName) && !string.IsNullOrEmpty(ConnectionStringConfig[keyName])) { connectionString = ConnectionStringConfig[keyName]; } else { var clientId = GetClaimValue(ApplicationConstants.X_CLIENT); if (clientId != 0) { var clientConfig = TenantDbConnection.Get(clientId); if (clientConfig != null && clientConfig.ContainsKey(keyName)) { connectionString = clientConfig[keyName]; } } } return(connectionString); }