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?
If you are using CSLA 4-3 (or older CSLA 4) look at this post for using the callback:
http://forums.lhotka.net/forums/p/11428/53069.aspx#53069
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.
Thanks,
Rahul
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:
<system.serviceModel> <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> <services> <service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Silverlight.WcfPortal"> <endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal" bindingConfiguration="BasicHttpBinding_IWcfPortal"> <identity> <dns value="localhost"/> </identity> </endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior name="returnFaults"> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> <behavior name="WcfPortalBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> <bindings> <basicHttpBinding> <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" /> <security> <transport realm="" /> </security> </binding> </basicHttpBinding> </bindings> </system.serviceModel> 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. Todd
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.
Hi,
There's at least 2 important mistakes.
I really recommend the Using CSLA 4 Ebooks and the http://download.lhotka.net/UsingCsla4-05/UsingCsla4-05-WPF-SL.pdf 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; }
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.
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() { BeginRefresh(CSLASilverlightTestApp.Library.Employees.GetEmployees); } }
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:DataGrid.Columns> <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" /> </sdk:DataGrid.Columns> </sdk:DataGrid>
As you BusinessObject (ie ViewModel.Model ) already is the list you want.
Then I would get the list of 4 employees shown correctly.
Thank JonnyBee and Todd for all of your help!
Copyright (c) Marimer LLC