Using an Object Factory for Mobile Data Portal

Using an Object Factory for Mobile Data Portal

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


thaehn posted on Friday, December 14, 2012

Hi,

I am converting a Silverlight app to use the Mobile Data Portal.  The configuration settings:

 <appSettings>
      <add key="ObjectFactoryAssembly" value="DataAccess.Mock"/>
      <add key="CslaObjectFactoryLoader" value="DataAccess.FactoryLoader,DataAccess"/>
</appSettings>

Are not beight pulled in.  I cannot call methods in the DAL assembly.   How do I change this to use the Mobile Data Portal?

RockfordLhotka replied on Friday, December 14, 2012

Silverlight doesn't use configuration files, so if you are putting that XML in a client-side file then it will surely be ignored. You need to set Silverlight configuration values through code as shown in the 'Using CSLA 4' ebook.

If that is server-side configuration in your web.config then it won't matter what data portal channel you are using (mobile, wcf, etc) because any code using that configuration will run long after the data portal is in its standard server-side processing pipeline - and that is totally independent of the network channel being used.

thaehn replied on Friday, December 14, 2012

It is server side for a Silverlight Application.  When I use the 4.3 csla.dll it works, but when I use the 4.5 csla dll it doesn't.

RockfordLhotka replied on Friday, December 14, 2012

Have you read through and adapted to the following?

http://www.lhotka.net/weblog/CSLADataPortalChangesInVersion45.aspx

thaehn replied on Saturday, December 15, 2012

Yes,

That's one of the posts I used as my guide.  Being I am using a server-side data portal, it appeared to me that the only change that I needed to make initially is changing the wcfDataPortal to use the Mobile instead of the Silverlight one from:

<% @ServiceHost Service="Csla.Server.Hosts.Silverlight.WcfPortal" %>

To:

 

<% @ServiceHost Service="Csla.Server.Hosts.Mobile.WcfPortal" %>

And the web.config from:
      <service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Silverlight.WcfPortal">
        <endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal" bindingConfiguration="BasicHttpBinding_IWcfPortal">
To:
      <service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Mobile.WcfPortal">
        <endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Mobile.IWcfPortal" bindingConfiguration="BasicHttpBinding_IWcfPortal">
I left the call the same in the business object:
        #region Factory Methods
        public static void GetLoginRoot(EventHandler<DataPortalResult<LoginRoot>> callback)
        {
            DataPortal.BeginFetch<LoginRoot>(callback);
        }
        
        #endregion
Which is invoked in the view model:
      BeginRefresh("GetLoginRoot");
I thought I could leave it like that to begin with and then try to figure out how to change it to an async call.

 

Copyright (c) Marimer LLC