I have a WCF service which logs any exceptions and then throws them as FaultExceptions.
I am doing a lot of repetition e.g. in each service method.
try {
// do some work
}
catch(Exception ex)
{
Logger.log(ex);
// actually will be Fault Exception but you get the idea.
throw ex;
}
I am looking for a more elegant way to do this as I am cutting and pasting the try/catch throughout each service.
Is there a design pattern /C# trick that could be used to make this more elegant?