1
- Imports System.Configuration
1
+ Imports System.Configuration
2
2
Imports System.Data.Common
3
3
Imports System.IO
4
4
Imports System.Reflection
@@ -46,14 +46,15 @@ Partial Public MustInherit Class Connection
46
46
End Sub
47
47
48
48
Private Shared Sub _staticInitCompleteProviders()
49
- Dim asms As New Dictionary (Of String , Reflection.Assembly )
49
+ Dim asms As New List (Of String )
50
50
Dim asmName As String
51
51
Dim connectionType As Type
52
52
Dim conn As Connection
53
53
Dim referencedAsms As Reflection.Assembly() = AppDomain.CurrentDomain.GetAssemblies()
54
54
For Each asm As Reflection.Assembly In referencedAsms
55
+ asmName = asm.GetName().Name
56
+ asms.Add(asmName)
55
57
If Connection._staticInitIsDatabasicSubAssembly(asm) Then
56
- asmName = asm.GetName().Name
57
58
connectionType = asm.GetType(asmName + ".Connection" )
58
59
If Not TypeOf connectionType Is Type Then Continue For
59
60
conn = Activator.CreateInstance(connectionType)
@@ -63,6 +64,29 @@ Partial Public MustInherit Class Connection
63
64
)
64
65
End If
65
66
Next
67
+ Try
68
+ Dim appDirAsms As IEnumerable( Of Assembly ) = (
69
+ From file In Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory)
70
+ Where Path.GetExtension(file).ToLower() = ".dll"
71
+ Select Assembly .LoadFrom(file)
72
+ )
73
+ For Each asm As System.Reflection.Assembly In appDirAsms
74
+ asmName = asm.GetName().Name
75
+ If (
76
+ Not asms.Contains(asmName) And
77
+ Connection._staticInitIsDatabasicSubAssembly(asm)
78
+ ) Then
79
+ connectionType = asm.GetType(asmName + ".Connection" )
80
+ If Not TypeOf connectionType Is Type Then Continue For
81
+ conn = Activator.CreateInstance(connectionType)
82
+ Connection._supportedProviders.Add(conn.ClientName, connectionType)
83
+ Connection._providersResources.Add(
84
+ conn.ClientName, Activator.CreateInstance(conn.ProviderResource)
85
+ )
86
+ End If
87
+ Next
88
+ Catch ex As Exception
89
+ End Try
66
90
End Sub
67
91
68
92
Private Shared Function _staticInitIsDatabasicSubAssembly(asm As Reflection.Assembly) As Boolean
0 commit comments