Breaking change problems between MethodCaller and Silverlight FactoryProxy CSLA 4.3

Breaking change problems between MethodCaller and Silverlight FactoryProxy CSLA 4.3

Old forum URL: forums.lhotka.net/forums/t/11283.aspx


csmith1 posted on Thursday, April 05, 2012

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);
          }

JonnyBee replied on Thursday, April 05, 2012

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. 

csmith1 replied on Thursday, April 05, 2012

Thanks,

I found it in Using CSLA document.

That just made the Mock DAL twice as complicated.

 

 

csmith1 replied on Monday, April 09, 2012

 I had to use Csla.DataPortalClient.FactoryProxy instead of LocalProxy for the handler.

 

 

Copyright (c) Marimer LLC