This project has moved and is read-only. For the latest updates, please go here.

Improving Silverlight generation

Jan 1, 2013 at 7:57 PM

Silverlight generation had some issues that are solved on the trunk.

As you know, one of the big issues about Silverlight code is the use of asynchronous methods when invoking the DataPortal. You can read more about it on the Technical Note: Silverlight code for CSLA 4

This has some side effects. Suppose your main form uses a NameValueList (NVL for short) to populate a ComboBox. You must get all the form data including the NVL at the same time or else you start to convert IDs to strings using the NVL while the NVL is still empty (has no data).

Take CslaGenFork Converted Properties. They used to convert the data on the server and store the converted data as a string. That increases the payload and your forms took longer to load. Now converted properties are converted on the client but still rely on NVL for the conversion.

If you try to use converted properties before the NVL is populated, you''l get a form full of blanks instead of useful data.

Rocky proposes the Unit of Work pattern to overcome this issue and believe me, it's not easy to it any other way. Of course you can try to use Caliburn Micro's coroutines, but I don't see the need to look elsewhere for a solution when there is a perfectly good solution originated on the CSLA world.

Up to Csla 4.3.13, all server side DataPortal code is synchronous and the Unit of Work pattern relies on this feature. What the Unit of Work does, is to load all the data you need so either:

  1. your object has no data yet
  2. your object has got all the data you need for the form

Unit of Work support

Right now, the code and templates on the trunk only support Unit of Work

  • Creator
  • Getter
  • CreatorGetter

This means the Updater and Deleter patterns aren't supported yet.

Rocky uses Unit of Work to do all sorts of things like creating or fetching child objects (useful for Web Forms) but CslaGenFork only supports it for

  • EditableRoot
  • EditableRootCollection
  • DynamicEditableRootCollection

Remember the main goal is useful and usable Silverlight code.

EditableRoot if fully debugged. Follow progress on the active issues of the Issue Tracker.

Happy new year to you all!

Jan 19, 2013 at 11:22 AM

UPDATE

Unit of Work 

  • Creator
  • Getter
  • CreatorGetter 

is ready for stereotypes

  • EditableRoot
  • EditableRootCollection
  • DynamicEditableRootCollection