diff --git a/src/Orc.DataAccess.Xaml/Controls/ConnectionStringBuilder/ViewModel/ConnectionStringEditViewModel.cs b/src/Orc.DataAccess.Xaml/Controls/ConnectionStringBuilder/ViewModel/ConnectionStringEditViewModel.cs index 11e57c7..8c44189 100644 --- a/src/Orc.DataAccess.Xaml/Controls/ConnectionStringBuilder/ViewModel/ConnectionStringEditViewModel.cs +++ b/src/Orc.DataAccess.Xaml/Controls/ConnectionStringBuilder/ViewModel/ConnectionStringEditViewModel.cs @@ -152,9 +152,25 @@ private void SetInitialState() } var allKnownProviders = Database.DbProvider.GetRegisteredProviders().Select(x => x.Value.Info).ToArray(); - if (allKnownProviders.Length == 1) + foreach (var provider in allKnownProviders) { - DbProvider = allKnownProviders.Single(); + var connectionString = provider.CreateConnectionString(_initialConnectionString); + if (connectionString is null) + { + continue; + } + + try + { + using var testConnection = provider.GetProvider().CreateConnection(connectionString.ToString()); + } + catch + { + continue; + } + + DbProvider = provider; + ConnectionString = connectionString; } }