Mixing CSLA for Windows and CSLA for Silverlight in a web app

Mixing CSLA for Windows and CSLA for Silverlight in a web app

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

agamboa posted on Thursday, May 06, 2010

I currently have a web application the uses CSLA for Windows, and its UI relies heavily Telerik's ASP.NET AJAX Controls.

I want to extend my application with controls that are only available in Telerik's Silverlight Controls.

I am in the process of ordering the training videos for CSLA Silverlight to help me with an implemention path; however, any insight on this would be greatly appreciated.

NOTE: without any practical knowledge in CSLA for Silverlight, I am thinking that  a "WCF layer" could be created that "talks" to my current CSLA for Windows business objects and just not use CSLA for Silverlight.



RockfordLhotka replied on Thursday, May 06, 2010

You can use the data portal (which does use WCF) to communicate between the SL client and your web server. The same business objects used on the web server can be used in the SL client.

There are some requirements for this to work though:

  1. Your properties must use managed backing fields
  2. Any non-SL code in your objects (like data access) must be server-side only (you can use partial classes or #if SILVERLIGHT compiler directives)
  3. Your synchronous factory methods need to be server-only
  4. You need async factory methods on the SL side
  5. Any business rules that interact with the server or database need to become async rules

If you are already using managed backing fields, you are most of the way there. Wrapping the existing factory methods and DataPortal_XYZ methods with #if !SILVERLIGHT directives gets you most of the rest of the way.

Then you just need to create async factory methods and for most objects you are all done.

The hardest part is if you have business rules that interact with the server/database - because you'll need to make them into async rules, on the SL side at least. Async rules are somewhat hard to use in ASP.NET because the app model is different on the web server.

agamboa replied on Thursday, May 06, 2010


Thanks for the prompt reply.  I am currently waiting for the link to download the CSLA Silverlight video series.  In the interim, I've downloaded and compiled CSLA for Silverlight 3.8.3 to get an idea what DLL's are involved.

Do you have any details on where and which(windows/silverlight) Csla.dll will exist in my web application?

Thanks again.


RockfordLhotka replied on Thursday, May 06, 2010

I see a purchase was processed earlier this morning - if you don't have the link yet check your spam folders, as the email is probably there.

The web server will use the Windows/.NET version of Csla.dll.

Copyright (c) Marimer LLC