I am creating a Webservice of the following form:
[SoapHeader ("Authentication")]
[WebMethod]
public SubmitBorrowerResponse AddBorrower(BorrowerDetails NewApplication)
{
//Do something
GetApplicantDetails(Applicant);
}
private static Applicant GetApplicantDetails(Applicant Applicant)
{
//Do something
return Applicant;
}
My question is, is it bad practice for me to use static
methods to do the work within the Webservice.
The methods are private, so could only be used as intended by the Webservice?
If not, what is the problem?
I do not see any benefit to creating an object and calling the method from the object, as no information will be stored in the object, and the Webserivce will only ever perform the actions defined in the page?
If anyone has any information that may help me understand the answer to this question, and information which could have helped me answer this on my own, I would be very grateful.
Why would you imagine that private static functions were bad practice?
The static keyword prevents the function from modifying member variables and properties, so its safer.
Now static variables... that's a very different matter. Never use static variables or properties in a web service, because they are not thread-safe.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.