Ganesh

Ganesh

  • NA
  • 42
  • 6.1k

How to initialize methods of a class using static constructor of the same class?

Sep 11 2012 3:13 AM
Hi Friends
I have one ASMX Web Service. I want to create a constructor for that class which initializes all the methods of that class.

The methods will load data from database so that when I create an object to that class they are automatically initialized.

Here below is my Web methods of my service
that web method calls function in InventoryManager module which will inearch with my data base. This is my project structure. so now I want to initialize all my functions in my constructor. so how can I proceed to do?

Public Class InventoryService
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloWorld() As String
       Return "Hello World"
    End Function

    <WebMethod()> _
    Public Function GetAllItems() As Item
        Return InventoryManager.GetAllItems()
    End Function

    <WebMethod()> _
    Public Function GetCustomers() As Person
        Return InventoryManager.GetAllCustomers()
    End Function

    Shared Sub New()

This is my Constructor in which I want to initialize all my methods of this class

    End Sub

End Class


Any help is really thank full to them.

Thanks in Advance
Ganesh

Answers (1)