hints needed for first project with WPF/SL,

hints needed for first project with WPF/SL,

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


vschaak posted on Monday, December 06, 2010

Hi folks,

currently and as a proof of concept project, we're planning to build a small app, based on an already launched winforms app that's business layer is created by using CSLA 3.8.2. Main goal is to proof, that by developing a business layer with a framework like CSLA, it can be reused for both, smart-client and web-apps. All that with exploring new UI-technology like WPF and/or SL. Both collegues newbies to both technologies, but with experience in winforms and ASP.net.

1) is it wise to reuse the core of the layer already build, or should it be rebuild for SL/WPF-use?

2) do we need two different versions of CSLA for SL AND WPF? (I'm a little confused about 'CSLA for SL' vs. 'CSLA for Windows')

3) Any simple samples, esp. for SL as UI-technology?

Where and how to start...?

Thanks for pushing me/us into the right direction ;-)

Volker

RockfordLhotka replied on Monday, December 06, 2010

The 

 will answer these questions with examples (though that content is aging, the price is discounted too :) ).

In general you should be able to reuse the existing business classes, though some types of code will be affected and you'll need to make adjustments.

  1. No data access code (DataPortal_XYZ) code can exist on the SL side - use #if !SILVERLIGHT statements to block that from builidng in SL
  2. Factory methods must be async on SL - sync factories aren't allowed - so add async factories and use #if !SILVERLIGHT to block out your sync factories
  3. All server interaction is async - this can affect your code in various ways, most notably in some business rules or any lazy loading

In my experience, with well-designed object models to start with you'll have to tamper with only a small percentage of your existing code - mostly to block compilation of the DataPortal_XYZ and sync factory methods.

You will need to build your classes twice - once for .NET and once for SL Your .NET class library will reference Csla.dll for .NET and your SL class library will reference Csla.dll for SL. You can use Visual Studio's "file linking" capability to easily get your code files to build into both projects.

There are numerous samples in the CSLA samples download - SimpleApp, etc. Some are more complex, but some are about as simple as can be.

 

Copyright (c) Marimer LLC