Silverlight is calling the MethodCaller with a handler to a CompletedHandler.
See FactoryProxy call below.
MethodCaller.CallMethod(command, _attribute.ExecuteMethodName, handler);
This actually calls line below in the MethodCaller.
CallMethod(object obj, string method, params object[] parameters)
The CompletedHandler is now a parameter. I do not see a CallMethod.
This causes multiple problems. One is CompletedHandler is never called. Some functions are never found.
I have changed my FactoryProxy is look like this.
try
{
var result = MethodCaller.CallMethod(obj, _attribute.FetchMethodName, criteria);
if ((result != null) && (result is T))
{
handler((T)result, null);
}
else
{
throw new NullReferenceException();
}
}
catch (Exception ex)
{
T empty = default(T);
handler(empty, ex);
}
If you use localproxy in Silverlight you should have metods that has a CallbackHandler as last parameter.
This is because the data access is asyncronous in Silverlight so the async data access (websevice?) must call the async callback handler.
Thanks,
I found it in Using CSLA document.
That just made the Mock DAL twice as complicated.
I had to use Csla.DataPortalClient.FactoryProxy instead of LocalProxy for the handler.
Copyright (c) Marimer LLC