33
44using System . Collections . Generic ;
55using System . Globalization ;
6+ using System . IO ;
67
78namespace System . Data . OleDb . Tests
89{
910 public static class Helpers
1011 {
1112 public const string IsDriverAvailable = nameof ( Helpers ) + "." + nameof ( GetIsDriverAvailable ) ;
12- public const string IsAceDriverAvailable = nameof ( Helpers ) + "." + nameof ( GetIsAceDriverAvailable ) ;
1313 public static bool GetIsDriverAvailable ( ) => Nested . IsAvailable ;
14- public static bool GetIsAceDriverAvailable ( ) => GetIsDriverAvailable ( ) && ! PlatformDetection . Is32BitProcess ;
1514 public static string ProviderName => Nested . ProviderName ;
1615 public static string GetTableName ( string memberName ) => memberName + ".csv" ;
1716
@@ -21,25 +20,34 @@ private class Nested
2120 public static readonly string ProviderName ;
2221 public static Nested Instance => s_instance ;
2322 private static readonly Nested s_instance = new Nested ( ) ;
24- private const string ExpectedProviderName = @"Microsoft.ACE.OLEDB.12.0" ;
2523 private Nested ( ) { }
2624 static Nested ( )
2725 {
2826 // Get the sources rowset for the SQLOLEDB enumerator
2927 DataTable table = ( new OleDbEnumerator ( ) ) . GetElements ( ) ;
3028 DataColumn providersRegistered = table . Columns [ "SOURCES_NAME" ] ;
31- List < object > providerNames = new List < object > ( ) ;
29+ List < string > providerNames = new List < string > ( ) ;
3230 foreach ( DataRow row in table . Rows )
3331 {
3432 providerNames . Add ( ( string ) row [ providersRegistered ] ) ;
3533 }
34+
3635 // skip if x86 or if the expected driver not available
37- IsAvailable = ! PlatformDetection . Is32BitProcess && providerNames . Contains ( ExpectedProviderName ) ;
38- if ( ! CultureInfo . CurrentCulture . Name . Equals ( "en-US" , StringComparison . OrdinalIgnoreCase ) )
36+ //IsAvailable = !PlatformDetection.Is32BitProcess && providerNames.Contains(ExpectedProviderName);
37+ // For the following culture check: https://github.com/dotnet/runtime/issues/29969
38+ if ( CultureInfo . CurrentCulture . Name . Equals ( "en-US" , StringComparison . OrdinalIgnoreCase ) )
3939 {
40- IsAvailable = false ; // ActiveIssue: https://github.com/dotnet/runtime/issues/29969
40+ ProviderName = providerNames . Contains ( "MSOLEDBSQL19" )
41+ ? "MSOLEDBSQL19"
42+ : providerNames . Contains ( "MSOLEDBSQL" )
43+ ? "MSOLEDBSQL"
44+ : null ;
45+
46+ if ( ProviderName is not null )
47+ {
48+ IsAvailable = true ;
49+ }
4150 }
42- ProviderName = IsAvailable ? ExpectedProviderName : null ;
4351 }
4452 }
4553 }
0 commit comments