Database: add ConnectionString class
This commit is contained in:
parent
0935510496
commit
c30ed9d4da
20
Modules.Database/ConnectionString.vb
Normal file
20
Modules.Database/ConnectionString.vb
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Public Class ConnectionString
|
||||||
|
Public Enum ConnectionStringType
|
||||||
|
MSSQLServer
|
||||||
|
ODBC
|
||||||
|
Oracle
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
Public Shared Function GetConnectionStringType(pConnectionString As String) As ConnectionStringType
|
||||||
|
' This variable only exists to shorten the if-conditions
|
||||||
|
Dim c = pConnectionString
|
||||||
|
|
||||||
|
If (c.Contains("Server=") Or c.Contains("Data Source=")) And (c.Contains("Database=") Or c.Contains("Initial Catalog=")) Then
|
||||||
|
Return ConnectionStringType.MSSQLServer
|
||||||
|
ElseIf (c.Contains("dsn=")) Then
|
||||||
|
Return ConnectionStringType.ODBC
|
||||||
|
Else
|
||||||
|
Return ConnectionStringType.Oracle
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
@ -91,6 +91,7 @@
|
|||||||
<Import Include="System.Threading.Tasks" />
|
<Import Include="System.Threading.Tasks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="ConnectionString.vb" />
|
||||||
<Compile Include="Constants.vb" />
|
<Compile Include="Constants.vb" />
|
||||||
<Compile Include="Exceptions.vb" />
|
<Compile Include="Exceptions.vb" />
|
||||||
<Compile Include="Adapters\Firebird.vb" />
|
<Compile Include="Adapters\Firebird.vb" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user