Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
How to initialize methods of a class using static constructor of the same class?
Ganesh
Sep 11 2012 3:13 AM
1.2k
Reply
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
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How to call a WCF Service from ASP.Net application using JQuery?
High level and low level test case