Custom Proxy Factory with WinRT in v.4.5.501

Custom Proxy Factory with WinRT in v.4.5.501

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


TSF posted on Thursday, June 12, 2014

I'm following the Using CSLA Data Portal e-book where it talks about implementing a custom proxy factory so that an app can support occasionally connected scenarios.

The SL example project shows the custom class that implements Csla.DataPortalClient.ProxyFactory. This doesn't appear to be valid interface within the Csla namespace for WinRT in v4.5.501. I do see IDataPortalProxyFactory, but this interface doesn't contain an overridable GetProxy method, which is necessary.

Are there changes in 4.5.501 that changes how I should create a custom proxy factory? Thanks.

TSF replied on Friday, June 13, 2014

After some experimenting, it seems like this works (i.e. the BO executes on either the local or remote portal when necessary). Is this a legitimate way of creating a custom proxy factory?

public

 

 

class ProxyFactory : Csla.DataPortalClient.IDataPortalProxyFactory
{

public IDataPortalProxy Create(Type objectType)
{
    if (bPullFromLocal)
        return new Csla.DataPortalClient.LocalProxy();
    else
        return new Csla.DataPortalClient.WcfProxy();
}

 }

Also, what does the ResetProxyType method do? When should I use it?

RockfordLhotka replied on Friday, June 13, 2014

Yes that is the intent of the new interface.

The ResetProxyType method is used to clear any cached proxy type your implementation may store. In your case you aren't storing a proxy type so you don't care, but in the DefaultPortalProxyFactory the proxy type is cached to improve performance.

Copyright (c) Marimer LLC