troubleshooting Question

Shared Functions in Public Class

Avatar of Meds
Meds asked on
ASP.NET
6 Comments2 Solutions328 ViewsLast Modified:
I have a User BLL class that contains shared functions for retrieval and updates of user records. I am declaring the functions as SHARED so I don't need to create a new instance of the UsersBLL everytime I need to use the functions. To further reduce the code size, I've created a read only property DetailsAdapter which only returns a new instance of UserDetailsTableAdapter each time its called. I just want to know if what I'm doing is thread safe? I'm just worried that I'm piling up new instances of DetailsAdapter in memory everytime I call a function. Will the DetailsAdapter object that I'm calling in every function gets destroyed after the function ends? Can somebody tell me the most efficient way to do this? Thanks.
Imports UserData
Imports UserDataTableAdapters
Public Class UsersBLL
    Protected Shared ReadOnly Property DetailsAdapter() As UserDetailsTableAdapter
        Get
            Return New UserDetailsTableAdapter
        End Get
    End Property
    Public Shared Function GetDetails(ByVal EmailAddress As String) As DataTable
        Return DetailsAdapter.GetData(EmailAddress)
    End Function
    'etc. I have other Shared functions here that uses DetailsAdapter similarly
End Class
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
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 2 Answers and 6 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