troubleshooting Question

Interfaces and Data Provider

Avatar of JRockFL
JRockFLFlag for United States of America asked on
Visual Basic.NET
2 Comments1 Solution299 ViewsLast Modified:
I have created an interface for the data provider and now im working on a base class for my data objects to inherit

I wanted to create a property that could be easily accessed in the base class.
Then I could just do Provider.ExecuteNonQuery() without having to  explicitly create an instance because it would be lazy loaded.

Make sense?

Public MustInherit Class DataLayerBase

    Private _provider As IDataProvider

    Public ReadOnly Property Provider() As IDataProvider
        Get
            If _provider Is Nothing Then
            ' dont think i can do this....
            End If
        End Get
    End Property

End Class


    Public Interface IDataProvider

        Function ExecuteNonQuery(ByVal sql As String) As Integer

        Function ExecuteNonQuery(ByVal sql As String, ByVal params As SortedList) As Integer

        Function ExecuteReader(ByVal sql As String) As IDataReader

        Function ExecuteReader(ByVal sql As String, ByVal params As SortedList) As IDataReader

        Function ExecuteScalar(ByVal sql As String) As Object

        Function ExecuteScalar(ByVal sql As String, ByVal params As SortedList) As Object

        Function ExecuteDataTable(ByVal sql As String) As DataTable

        Function ExecuteDataTable(ByVal sql As String, ByVal params As SortedList) As DataTable

        Function ExecuteDataSet(ByVal sql As String) As DataSet

        Function ExecuteDataSet(ByVal sql As String, ByVal params As SortedList) As DataSet

    End Interface
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros