' ////////////////////////////////////////////////////////////////////////////////////////// ' // Description: Base class for Database Interaction. ' // Generated by LLBLGen v1.21.2003.712 Final on: Freitag, 4. Januar 2013, 16:59:46 ' // Because this class implements IDisposable, derived classes shouldn't do so. ' ////////////////////////////////////////////////////////////////////////////////////////// Imports System Imports System.Configuration Imports System.Data Imports System.Data.SqlClient Imports System.Data.SqlTypes Namespace DB ' /// ' /// Purpose: Error Enums used by this LLBL library. ' /// Public Enum LLBLError AllOk ' // Add more here (check the comma's!) End Enum ' /// ' /// Purpose: General interface of the API generated. Contains only common methods of all classes. ' /// Public Interface ICommonDBAccess Function Insert() As Boolean Function Update() As Boolean Function Delete() As Boolean Function SelectOne() As DataTable Function SelectAll() As DataTable End Interface ' /// ' /// Purpose: Abstract base class for Database Interaction classes. ' /// Public MustInherit Class clsDBInteractionBase Implements IDisposable Implements ICommonDBAccess #Region " Class Member Declarations " Protected m_scoMainConnection As SqlConnection Protected m_iRowsAffected As Integer Protected m_iErrorCode As SqlInt32 Protected m_bMainConnectionIsCreatedLocal As Boolean Protected m_cpMainConnectionProvider As clsConnectionProvider Private m_sConnectionString As String Private m_bIsDisposed As Boolean #End Region ' /// ' /// Purpose: Class constructor. ' /// Public Sub New() ' // Initialize the class' members. InitClass() End Sub ' /// ' /// Purpose: Initializes class members. ' /// Private Sub InitClass() ' // create all the objects and initialize other members. m_scoMainConnection = new SqlConnection() m_bMainConnectionIsCreatedLocal = True m_cpMainConnectionProvider = Nothing m_iErrorCode = New SqlInt32(LLBLError.AllOk) m_bIsDisposed = False End Sub ' /// ' /// Purpose: Implements the IDispose' method Dispose. ' /// Overloads Public Sub Dispose() Implements IDisposable.Dispose Dispose(True) GC.SuppressFinalize(Me) End Sub ' /// ' /// Purpose: Implements the Dispose functionality. ' /// Overridable Overloads Protected Sub Dispose(ByVal bIsDisposing As Boolean) ' // Check to see if Dispose has already been called. If Not m_bIsDisposed Then If bIsDisposing Then ' // Dispose managed resources. If m_bMainConnectionIsCreatedLocal Then ' // Object is created in this class, so destroy it here. m_scoMainConnection.Close() m_scoMainConnection.Dispose() m_bMainConnectionIsCreatedLocal = True End If m_cpMainConnectionProvider = Nothing m_scoMainConnection = Nothing End If End If m_bIsDisposed = True End Sub ' /// ' /// Purpose: Implements the ICommonDBAccess.Insert() method. ' /// Public Overridable Function Insert() As Boolean Implements ICommonDBAccess.Insert ' // No implementation, throw exception Throw New NotImplementedException() End Function ' /// ' /// Purpose: Implements the ICommonDBAccess.Delete() method. ' /// Public Overridable Function Delete() As Boolean Implements ICommonDBAccess.Delete ' // No implementation, throw exception Throw New NotImplementedException() End Function ' /// ' /// Purpose: Implements the ICommonDBAccess.Update() method. ' /// Public Overridable Function Update() As Boolean Implements ICommonDBAccess.Update ' // No implementation, throw exception Throw New NotImplementedException() End Function ' /// ' /// Purpose: Implements the ICommonDBAccess.SelectOne() method. ' /// Public Overridable Function SelectOne() As DataTable Implements ICommonDBAccess.SelectOne ' // No implementation, throw exception Throw New NotImplementedException() End Function ' /// ' /// Purpose: Implements the ICommonDBAccess.SelectAll() method. ' /// Public Overridable Function SelectAll() As DataTable Implements ICommonDBAccess.SelectAll ' // No implementation, throw exception Throw New NotImplementedException() End Function #Region " Class Property Declarations " Public WriteOnly Property cpMainConnectionProvider() As clsConnectionProvider Set(ByVal Value As clsConnectionProvider) If Value Is Nothing Then ' // Invalid value Throw New ArgumentNullException("cpMainConnectionProvider", "Nothing passed as value to this property which is not allowed.") End If ' // A connection provider object is passed to this class. ' // Retrieve the SqlConnection object, if present and create a ' // reference to it. If there is already a MainConnection object ' // referenced by the membervar, destroy that one or simply ' // remove the reference, based on the flag. If Not (m_scoMainConnection Is Nothing) Then ' // First get rid of current connection object. Caller is responsible If m_bMainConnectionIsCreatedLocal Then ' // Is local created object, close it and dispose it. m_scoMainConnection.Close() m_scoMainConnection.Dispose() End If ' // Remove reference. m_scoMainConnection = Nothing End If m_cpMainConnectionProvider = CType(Value, clsConnectionProvider) m_scoMainConnection = m_cpMainConnectionProvider.scoDBConnection m_bMainConnectionIsCreatedLocal = False End Set End Property Public ReadOnly Property iErrorCode() As SqlInt32 Get Return m_iErrorCode End Get End Property Public Property sConnectionString() As String Get Return m_sConnectionString End Get Set (ByVal Value As String) m_sConnectionString = Value m_scoMainConnection.ConnectionString = m_sConnectionString End Set End Property Public Readonly Property iRowsAffected() As Integer Get Return m_iRowsAffected End Get End Property #End Region End Class End Namespace