Database: Throw when Connection is nothing in MaybeGetTransaction
This commit is contained in:
parent
4c78e6e5a7
commit
d32a14c4d8
@ -134,6 +134,8 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Monitor", "GUIs.Monitor\Mon
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MonoRepoUtils", "ConfigCreator\MonoRepoUtils.vbproj", "{9D4AC920-C78E-41C3-994E-91690FF79380}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Database.Cached", "Database.Cached\Database.Cached.vbproj", "{E0DC883D-FAE1-4103-B2BA-043EBE697B09}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -356,6 +358,10 @@ Global
|
||||
{9D4AC920-C78E-41C3-994E-91690FF79380}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9D4AC920-C78E-41C3-994E-91690FF79380}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9D4AC920-C78E-41C3-994E-91690FF79380}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E0DC883D-FAE1-4103-B2BA-043EBE697B09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E0DC883D-FAE1-4103-B2BA-043EBE697B09}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E0DC883D-FAE1-4103-B2BA-043EBE697B09}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E0DC883D-FAE1-4103-B2BA-043EBE697B09}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -415,6 +421,7 @@ Global
|
||||
{65EFB268-C0E0-40C1-8981-9F70DEE5C74A} = {F98C0329-C004-417F-B2AB-7466E88D8220}
|
||||
{E24E8D40-0361-4C07-8FAE-3621DE316E70} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB}
|
||||
{9D4AC920-C78E-41C3-994E-91690FF79380} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB}
|
||||
{E0DC883D-FAE1-4103-B2BA-043EBE697B09} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}
|
||||
|
||||
@ -74,6 +74,10 @@ Public Class MSSQLServer
|
||||
End Function
|
||||
|
||||
Private Function MaybeGetTransaction(Connection As SqlConnection, Mode As TransactionMode, Transaction As SqlTransaction) As SqlTransaction
|
||||
If Connection Is Nothing Then
|
||||
Throw New ArgumentNullException("Connection")
|
||||
End If
|
||||
|
||||
If Mode = TransactionMode.NoTransaction Then
|
||||
Return Nothing
|
||||
ElseIf Mode = TransactionMode.ExternalTransaction Then
|
||||
@ -176,14 +180,15 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' This Function intentionally has no try..catch block to have any errors caught outside
|
||||
''' </summary>
|
||||
''' <param name="Connection"></param>
|
||||
''' <returns></returns>
|
||||
Private Function OpenSQLConnection(Connection As SqlConnection) As SqlConnection
|
||||
Try
|
||||
If Connection.State = ConnectionState.Closed Then
|
||||
Connection.Open()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
Return Connection
|
||||
End Function
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user