Issue with Silverlight with bxf in CSLA 4.0 factory model with fetching data

Issue with Silverlight with bxf in CSLA 4.0 factory model with fetching data

Old forum URL:

devbcorleone posted on Wednesday, May 15, 2013

My Dev team is having issues to incorporate Silverlight with Bxf in the CSLA 4.0 Factory Model, that has to call the wcf to fetch the data from database.

Has anybody faced similar issues? Any help in this regard is appreciated as we are hitting the wall at this time!

JonnyBee replied on Wednesday, May 15, 2013

What is the problem here? Is it Bxf or CSLA related?

Which version of CSLA 4 do you use?

There is no problem in using the CSLA 4 Factory model in Silverlight or WinRT in an "edge" application that calls web services asyncronously provided that you use the asyncronous call to DataPortal. 

Can you provide us with some sample project to show the problem?

JonnyBee replied on Thursday, May 16, 2013

If you are using CSLA 4-3 (or older CSLA 4) look at this post for using the callback: 

Rahul.Kadam replied on Friday, May 17, 2013

We are evaluating CSLA.NET for a Silverlight Application using MVVM Pattern.

We are facing problem to fetch the data from WCF Data portal channel using factory implementation model.

Here is a link to solution that demonstrates the issue.

We are using CSLA.NET 4.3 release.

I Would appreciate any help that is offered.


thaehn replied on Friday, May 17, 2013

I would suggest you get Rocky's video series on CSLA MVVM and follow along with the examples.  You should start with his sample project and work your own stuff into it.  I started with that and added the factory loader and eventually moved from BXF to Caliburn with MEF for the front end. 

I was able to get farther down the road with your project by moving the WcfPortal.svc and the Web.config (with modifications) from the TestAppWCF project intot he TestAppWeb project.  When I got that far I received serialization errors on your business objects.

I change dthe WcfPortal to:




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

and in the web config I replaced the servicemodel section with:


    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>


      <service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Silverlight.WcfPortal">

        <endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal" bindingConfiguration="BasicHttpBinding_IWcfPortal">


            <dns value="localhost"/>







        <behavior name="returnFaults">

          <serviceDebug includeExceptionDetailInFaults="true"/>


        <behavior name="WcfPortalBehavior">

          <serviceMetadata httpGetEnabled="true"/>

          <serviceDebug includeExceptionDetailInFaults="true"/>






        <binding name="BasicHttpBinding_IWcfPortal" closeTimeout="00:10:00"

         openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"

         maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">

          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"

           maxBytesPerRead="2147483647" />


            <transport realm="" />






Change the project to use the local IIS server and change the app.xaml.cs call to:

sla.DataPortalClient.WcfProxy.DefaultUrl = new Uri(Current.Host.Source, "../WcfPortal.svc").ToString();

These are settings that I use. I also remove the two lines:

    <add key="CslaWriter" value="Csla.Serialization.Mobile.CslaBinaryWriter, Csla"/>

    <add key="CslaReader" value="Csla.Serialization.Mobile.CslaBinaryReader, Csla"/>


from the web config (I don't have them in mine). Not necessarily all necessary changes, but that's how I do it.





thaehn replied on Friday, May 17, 2013

Oh, and I forgot to add, that I added the DLLs for the Business Objects to the web project and set it as the startup project.

JonnyBee replied on Friday, May 17, 2013


There's at least 2 important mistakes.

  1. The BusinessLibrary in SL and .NET - MUST HAVE THE SAME ASSEMBLY NAME AND NAMESPACE to be compatible in serializer.

I really recommend the Using CSLA 4 Ebooks  and the is spot on for this application.

Your factory DAL  should look somewhat like this:

    public class EmployeeDal : Csla.Server.ObjectFactory
        private Employees Fetch()
          var result = new Employees();
          result.AddRange(from r in MockDb.Employees
                          select new Employee
                              EmployeeID = r.EmployeeID,
                              FirstName = r.FirstName,
                              LastName = r.LastName
            return result;

JonnyBee replied on Friday, May 17, 2013

I have some questions to your architecture as well.

As of the code you posted you have a N-tier deployment where the NET Service may call WCF or access databases AND RETURN BUSINESS OBJECTS.

JonnyBee replied on Friday, May 17, 2013

Next problem is your use of the ViewModel.

I updated the EmployeeList viewmodel to be just this code:

    public class EmployeeList : ViewModel<CSLASilverlightTestApp.Library.Employees>
        public EmployeeList()

And changed the data grid datacontext to the Model property of the ViewModel:

        <sdk:DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Path=Model}" 
                  Name="modelDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected">
                <sdk:DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=EmployeeID}" Header="EmployeeID" IsReadOnly="True" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="FNameColumn" Binding="{Binding Path=FirstName}" Header="FirstName" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="LNameColumn" Binding="{Binding Path=LastName}" Header="LastName" Width="SizeToHeader" />

As you BusinessObject  (ie ViewModel.Model ) already is the list you want.

Then I would get the list of 4 employees shown correctly.

devbcorleone replied on Monday, May 20, 2013

Thank JonnyBee and Todd for all of your help!

Copyright (c) Marimer LLC