Skip to content

Commit

Permalink
release 1.2.6 - provider detection fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tomFlidr committed Oct 23, 2017
1 parent 3e4b071 commit dd133b3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
30 changes: 27 additions & 3 deletions Connection/StaticInit.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Imports System.Configuration
Imports System.Configuration
Imports System.Data.Common
Imports System.IO
Imports System.Reflection
Expand Down Expand Up @@ -46,14 +46,15 @@ Partial Public MustInherit Class Connection
End Sub

Private Shared Sub _staticInitCompleteProviders()
Dim asms As New Dictionary(Of String, Reflection.Assembly)
Dim asms As New List(Of String)
Dim asmName As String
Dim connectionType As Type
Dim conn As Connection
Dim referencedAsms As Reflection.Assembly() = AppDomain.CurrentDomain.GetAssemblies()
For Each asm As Reflection.Assembly In referencedAsms
asmName = asm.GetName().Name
asms.Add(asmName)
If Connection._staticInitIsDatabasicSubAssembly(asm) Then
asmName = asm.GetName().Name
connectionType = asm.GetType(asmName + ".Connection")
If Not TypeOf connectionType Is Type Then Continue For
conn = Activator.CreateInstance(connectionType)
Expand All @@ -63,6 +64,29 @@ Partial Public MustInherit Class Connection
)
End If
Next
Try
Dim appDirAsms As IEnumerable(Of Assembly) = (
From file In Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory)
Where Path.GetExtension(file).ToLower() = ".dll"
Select Assembly.LoadFrom(file)
)
For Each asm As System.Reflection.Assembly In appDirAsms
asmName = asm.GetName().Name
If (
Not asms.Contains(asmName) And
Connection._staticInitIsDatabasicSubAssembly(asm)
) Then
connectionType = asm.GetType(asmName + ".Connection")
If Not TypeOf connectionType Is Type Then Continue For
conn = Activator.CreateInstance(connectionType)
Connection._supportedProviders.Add(conn.ClientName, connectionType)
Connection._providersResources.Add(
conn.ClientName, Activator.CreateInstance(conn.ProviderResource)
)
End If
Next
Catch ex As Exception
End Try
End Sub

Private Shared Function _staticInitIsDatabasicSubAssembly(asm As Reflection.Assembly) As Boolean
Expand Down
2 changes: 1 addition & 1 deletion Databasic.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata minClientVersion="2.6">
<id>Databasic.Core</id>
<version>1.2.5.0</version>
<version>1.2.6.0</version>
<title>Databasic - Core</title>
<authors>Tom Flidr</authors>
<owners>Tom Flidr</owners>
Expand Down
4 changes: 2 additions & 2 deletions My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ Install this package only with specific database package like:
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.2.5.0")>
<Assembly: AssemblyFileVersion("1.2.5.0")>
<Assembly: AssemblyVersion("1.2.6.0")>
<Assembly: AssemblyFileVersion("1.2.6.0")>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Databasic - Core Package

[![Latest Stable Version](https://img.shields.io/badge/Stable-v1.2.5-brightgreen.svg?style=plastic)](https://github.com/databasic-net/databasic-core/releases)
[![Latest Stable Version](https://img.shields.io/badge/Stable-v1.2.6-brightgreen.svg?style=plastic)](https://github.com/databasic-net/databasic-core/releases)
[![License](https://img.shields.io/badge/Licence-BSD3-brightgreen.svg?style=plastic)](https://raw.githubusercontent.com/databasic-net/databasic-core/master/LICENCE.md)
![.NET Version](https://img.shields.io/badge/.NET->=4.0-brightgreen.svg?style=plastic)

Expand Down

0 comments on commit dd133b3

Please sign in to comment.