I am faced with a design/architectural problem, and can't figure out a clean solution. We have a .NET WebService with hundreds of WebMethods. (See example below). If any of the called WebMethods throws an unhandled exception, we want to generate an email.
Question: What would be a clean design pattern to use in such a situation. I want to avoid inserting repetitive code into hundreds of methods?
[WebService(Namespace = "http://example.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Serializable]
public class WebService : System.Web.Services.WebService
{
[WebMethod]
public string GetQuoteInfo(string request)
{
return QuoteService.GetQuoteInfo(request);
}
[WebMethod]
public string GetQuoteAPR(string request)
{
return QuoteService.GetQuoteAPR(request);
}
[WebMethod]
public string GetAccountContactInfo(string request)
{
return AccountService.GetAccountContactInfo(request);
}
...
...
...
[WebMethod]
public string GetAccountContactInfo(string request)
{
// implementation
}
}
Aucun commentaire:
Enregistrer un commentaire