У меня есть много методов веб-сервиса, и я хочу проверить их все в одной функции. Например;
[Intercept]
public string Method1(POS pos, int param1, string param2)
{
return String.Format("{0}: {1}", param1,param2);
}
[Intercept]
public int Method2(POS pos, int param3)
{
return param3 * 2;
}
public void OnPreProcessing(...)
{
// Before Mothod1 and Method2 called, It should enter here
// I want to be able to cancel method execution and return another value.
// I want to get the method name, parameter names and values
}
Теперь для этого я использую ContextBoundObject и IMessageSink. Я могу получить имя метода, параметры и значения, но не могу отменить выполнение метода и вернуть другое значение. Я использую что-то вроде ниже.
public IMessage SyncProcessMessage(IMessage msg)
{
var mcm = msg as IMethodCallMessage;
OnPreProcessing(ref mcm);
var retMsg = _NextSink.SyncProcessMessage(msg) as IMethodReturnMessage;
OnPostProcessing(mcm, ref retMsg);
return retMsg;
}
Как я могу отменить выполнение метода и вернуть другие значения?
Спасибо.