Database: Add debugger step through attributes
This commit is contained in:
parent
1102542d26
commit
7e952093c7
@ -141,7 +141,7 @@ Public Class MSSQLServer
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Public Function Get_ConnectionStringforID(pConnectionId As Integer)
|
||||
Public Function Get_ConnectionStringforID(pConnectionId As Integer) As String
|
||||
Dim connectionString As String = ""
|
||||
Try
|
||||
Dim oDTConnection As DataTable = GetDatatable($"SELECT * FROM TBDD_CONNECTION WHERE GUID = {pConnectionId}")
|
||||
@ -180,12 +180,11 @@ Public Class MSSQLServer
|
||||
Return connectionString
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
<DebuggerStepThrough()>
|
||||
Private Function TestCanConnect() As Boolean
|
||||
Return TestCanConnect(CurrentSQLConnectionString)
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
Private Function TestCanConnect(ConnectionString As String) As Boolean
|
||||
Try
|
||||
_Logger.Debug("Testing connection to [{0}]", MaskConnectionString(ConnectionString))
|
||||
@ -201,7 +200,6 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
Private Function TestCanConnect(Connection As SqlConnection) As Boolean
|
||||
Try
|
||||
If Connection Is Nothing Then
|
||||
@ -225,7 +223,6 @@ Public Class MSSQLServer
|
||||
''' </summary>
|
||||
''' <param name="Connection"></param>
|
||||
''' <returns></returns>
|
||||
'<DebuggerStepThrough()>
|
||||
Private Function OpenSQLConnection(Connection As SqlConnection) As SqlConnection
|
||||
If Connection.State = ConnectionState.Closed Then
|
||||
Connection.Open()
|
||||
@ -234,12 +231,11 @@ Public Class MSSQLServer
|
||||
Return Connection
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
<DebuggerStepThrough()>
|
||||
Private Function GetSQLConnection() As SqlConnection
|
||||
Return GetConnection(CurrentSQLConnectionString)
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
Private Function GetConnection(ConnectionString As String) As SqlConnection
|
||||
Try
|
||||
Dim oConnection As New SqlConnection(ConnectionString)
|
||||
@ -272,7 +268,7 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetDatatable(SqlCommand As String) As DataTable Implements IDatabase.GetDatatable
|
||||
Return GetDatatable(SqlCommand, _Timeout)
|
||||
End Function
|
||||
@ -282,33 +278,31 @@ Public Class MSSQLServer
|
||||
''' </summary>
|
||||
''' <param name="SqlCommand">sqlcommand for datatable (select XYZ from TableORView)</param>
|
||||
''' <returns>Returns a datatable</returns>
|
||||
'<DebuggerStepThrough()>
|
||||
Public Function GetDatatable(SqlCommand As String, Timeout As Integer) As DataTable Implements IDatabase.GetDatatable
|
||||
Using oSqlConnection = GetSQLConnection()
|
||||
Return GetDatatableWithConnectionObject(SqlCommand, oSqlConnection, TransactionMode.WithTransaction, Nothing, Timeout)
|
||||
End Using
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetDatatable(SqlCommand As String, Transaction As SqlTransaction, Optional Timeout As Integer = 120) As DataTable
|
||||
Using oSqlConnection = GetSQLConnection()
|
||||
Return GetDatatableWithConnectionObject(SqlCommand, oSqlConnection, TransactionMode.ExternalTransaction, Transaction, Timeout)
|
||||
End Using
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
<DebuggerStepThrough()>
|
||||
Public Async Function GetDatatableAsync(SqlCommand As String, Optional Timeout As Integer = 120) As Task(Of DataTable)
|
||||
Return Await Task.Run(Function() GetDatatable(SqlCommand, Timeout))
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetDatatableWithConnection(SqlCommand As String, ConnectionString As String, Optional Timeout As Integer = 120) As DataTable
|
||||
Using oConnection = GetConnection(ConnectionString)
|
||||
Return GetDatatableWithConnectionObject(SqlCommand, oConnection, Timeout:=Timeout)
|
||||
End Using
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
Public Function GetDatatableWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
||||
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
||||
Optional Transaction As SqlTransaction = Nothing,
|
||||
@ -338,7 +332,7 @@ Public Class MSSQLServer
|
||||
Return oTable
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
<DebuggerStepThrough()>
|
||||
Public Function ExecuteNonQuery(SQLCommand As String) As Boolean Implements IDatabase.ExecuteNonQuery
|
||||
Using oConnection = GetSQLConnection()
|
||||
Return ExecuteNonQueryWithConnectionObject(SQLCommand, oConnection, TransactionMode.WithTransaction, Nothing, _Timeout)
|
||||
@ -371,7 +365,6 @@ Public Class MSSQLServer
|
||||
End Using
|
||||
End Function
|
||||
|
||||
'<DebuggerStepThrough()>
|
||||
Public Function ExecuteNonQueryWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
||||
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
||||
Optional Transaction As SqlTransaction = Nothing,
|
||||
@ -429,7 +422,6 @@ Public Class MSSQLServer
|
||||
End Using
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetScalarValueWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
||||
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
||||
Optional Transaction As SqlTransaction = Nothing,
|
||||
@ -456,7 +448,6 @@ Public Class MSSQLServer
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetScalarValue(SQLCommand As SqlCommand, OutputParameter As String, Timeout As Integer) As Object
|
||||
Try
|
||||
If TestCanConnect() = False Then
|
||||
@ -500,7 +491,6 @@ Public Class MSSQLServer
|
||||
''' <param name="SqlCommand">the sql statement</param>
|
||||
''' <param name="commandtimeout">Optional Timeout</param>
|
||||
''' <remarks></remarks>
|
||||
<DebuggerStepThrough()>
|
||||
Public Sub NewExecuteNonQueryAsync(SqlCommand As String, Optional commandtimeout As Integer = 120)
|
||||
_Logger.Debug("NewExecuteNonQueryAsync: Running Query [{0}]", SqlCommand)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user