This document is the change log for version 3.6.0 of CSLA .NET for Silverlight.
For a more complete list of changes, go to http://www.lhotka.net/cslabugs, select “all issues” and filter the status to “closed” and/or “checked in”.
Click here for a list of known issues with this version.
XML comments (081217)
Added/changed numerous comments in code.
Change how the control refreshes data on initial load, so it doesn’t refresh before parameters are set through XAML.
Ensure control sets the IsBusy property during a Save() operation.
ChildChanged event (081204)
Reworked the entire ChildChanged code, eliminating the ___Internal() methods and simplifying the overall process. This should fix the issue where the events weren’t working after deserialization.
Fixed an issue with SetProperty() where a null input value wasn’t properly being converted to string.Empty.
Fixed an issue where an exception thrown from an async rule method wouldn’t be properly caught by the CheckRules() method. Of course async rule methods should never throw an exception, but this fix is still valuable.
When an object is saved and an exception occurs, the original object is now restored to the collection as it was before the ApplyEdit() call. This is a major change to the save functionality, and addresses some common issues using ERLB when such an exception occurs.
When an object is saved and an exception occurs, the original object is now restored as it was before the ApplyEdit() call. This is a major change to the save functionality, and addresses some common issues using the CslaDataProvider when such an exception occurs.
Fix an issue that was blocking the use of ListChanged or ChildChanged in a parent object to trigger checking validation rules against child objects.
Clean up code dealing with child event handling.
Treat the CanXYZ “methods” as properties when enabling and disabling the UI control. In other words, the target resource should implement a property like CanSave rather than a method like CanSave() to indicate whether the Save() method is currently a valid option.
Include inner exception when throwing property load exception.
Fix issue with CoerceValue() and DateTime types losing precision.
Data Portal (081103)
SynchronizedWcfProxy is no longer used by default, even in debug mode.
BusinessBase now implements IAuthorizeReadWrite.
Beta 2a 3.6.0-081102:
Enhance Navigator to provide better pre- and post-transition extensibility.
Change IsSavable for better performance.
Remove the Create() and Fetch() methods, as they were replaced by Refresh() a while back, and just didn’t get removed.
Fix bug where you couldn’t inherit from CslaDataProvider.
Beta 2 3.6.0-081021:
Added the ObjectInstance property to the control, and changed the Data property to be read-only. This makes the control match the WPF equivalent.
Reworked the Navigator control so it now supports the scenario where a user bookmarks a URL and navigates directly to that URL in a new browser instance. It is now possible for the Silverlight app to navigate directly to the appropriate control/data. The Navigator control now uses a provider model, allowing better control over the formatting and parsing of the URL bookmark value.
Silverlight 2.0 RTW (081013)
Build CSLA .NET against the release version of Silverlight 2.0.
Beta 1a 3.6.0-081009:
PropertyChanging event (081008)
BusinessBase now raises a PropertyChanging event like .NET. This event and associated INotifyPropertyChanging interface are declared entirely in CSLA .NET for Silverlight, but offer better compatibility with .NET.
Add a BypassPropertyChecks object to BusinessBase to allow a block of code to turn off authorization, business and validation rules on properties. The BypassPropertyChecks object is protected, and is designed to be used with a using statement in a DataPortal_XYZ or object factory method. Inside that using statement you can directly get and set the properties without any authz or business rules executing.
Design-time data in Expression Blend (081002)
Add support to the data portal for detecting that the code is running in design-time, so it routes the data portal call to a DesignTime_Create() method rather than doing any normal create or fetch processing. This allows a root business object to implement a DesignTime_Create() method that loads the object with sample or mock data for display in the Expression Blend design experience.
Data Portal (081001)
Fix an issue with passing array data as a parameter to the child data portal. The MethodCaller now has a much simpler overall algorithm to deal with method overloads, and also handles this array scenario.
Data Portal (080930)
Changed the data portal to default to using the WcfProxy instead of SynchronizedWcfProxy. This means that the data portal will now allow parallel WCF calls to the server, because the 404 issue has been resolved.
Fix an issue where PropertyStatus might not show icons for broken rules as the form is initially loaded.
Change the PropertyStatus control to hide the popup when the user moves the mouse off the icon.
Beta 1 3.6.0-080926:
Silverlight 2.0 RC0 (080926)
Updated CSLA .NET code to work with Silverlight 2.0 RC0.
Parent property (080921)
Fix issue where Parent property wasn’t restored on deserialization.
Fix popup positioning.
Data Portal (080921)
Fix inconsistencies in method implementations.
The control now exposes all the status and authorization properties for the underlying business object. This means CslaDataProvider now effectively provides the features of Csla.Wpf.ObjectStatus.
Implement a DisableIEditableObject property that works like the .NET version, suppressing the IEditableObject interface. Due to some current Silverlight data binding issues with the data grid, this may be necessary in some scenarios.
Change the class to not be abstract so it can be used directly. This is particularly useful when using it from a pure .NET client or web site.
Added the ObjectFactory concept and related classes to the Silverlight data portal.
Changed the API of CslaDataProvider to make it more consistent with the WPF implementation.
InvokeMethod, when bound to a method like Xyz(),now enables/disables the UI control based on the value of a CanXyz() method implemented on the resource. CslaDataProvider now provides such methods, so button controls can automatically enable/disable based on the status of the business object – just like they do with commanding in WPF. This behavior can be turned off if you want to bind the UI control’s IsEnabled property manually.
Async behaviors (080910)
Ensure that all async methods (like BeginSave()) have an overload allowing user state to be passed through the process and exposed in the resulting event or callback.
The CommandBase class now implements the field manager functionality, allowing a developer to use managed backing fields like they can in BB or ROB. The reason for this is to enable easier serialization to/from Silverlight.
Unit testing (080828)
To avoid some timing issues with async operations, UnitDriven now only runs one test at a time. The issue comes because all Silverlight code in an app runs in one AppDomain and so it is difficult (impossible?) to get good isolation between tests that alter static fields or other shared values. Running one test at a time slows things down, but avoids having tests alter shared values out from under each other.
Data Portal (080828)
Due to a bug in the Silverlight WCF technology, we have altered the data portal so it will only allow one outstanding WCF request at a time. This has a pretty big negative performance impact if the client is making a lot of simultaneous server calls (like our unit tests), but avoids the alternative, which is a lot of unreliable 404 responses that should have worked. In other words, if we allow overlapping WCF calls then some of those calls will result in a 404 exception, when they should have succeeded. Hopefully we can remove this “enhancement” if and when that WCF bug is fixed.
IsBusy Property (080818)
BusinessBase and ReadOnlyBase now have an IsBusy property that returns true when the object has an outstanding async operation running. This is comparable to the similar property-level functionality used by async validation rule processing. There are protected methods called MarkBusy() and MarkIdle() to allow a business developer to set the property, and that can be useful if you implement your own async method behaviors.
LoadPropertyAsync Method (080818)
BusinessBase and ReadOnlyBase now have LoadPropertyAsync() methods to allow for asynchronous lazy loading of child objects. This method works much like LoadProperty(), but performs the data portal operation on a background thread. The async result is automatically put into the property when available, and a PropertyChanged event is raised so data binding knows to display the now-available data.
CommandBase is now functional, which completes all the base classes from CSLA .NET – so all the stereotypes are now supported.
Silverlight Grid (080814)
Created custom grid column types for Text and Checkbox that understand CSLA Light validation and authorization behaviors. This allows the grid to have much the same behavior as detail controls on a per-property basis.
CslaDataProvider control (080814)
Created a Csla.Silverlight.CslaDataProvider class that works somewhat like the WPF CslaDataProvider control, allowing XAML-based retrieve, save, cancel, add new and remove item operations without the need for code-behind.
InvokeMethod control (080814)
Created a Csla.Silverlight.InvokeMethod class that provides functionality somewhat like WPF commanding. This control listens for an event from a control (such as a button’s click event) and when that event is handled, it invokes a method on a resource (such as a CslaDataProvider control).
This is still a work in progress and may change.
BusyAnimation control (080814)
Created a BusyAnimation control that is used to display busy status of an object or property.
ObjectStatus control (080814)
Created ObjectStatus control that uses templates to change the display of its contents based on the authorization status of the business object. This control also changes the display based on the async busy status of the business object.
PropertyStatus control (080814)
Renamed Csla.Wpf.Validator to Csla.Silverlight.PropertyStatus. This control now handles not only validation, but also authorization and busy notification for async operations.
Enhanced the various principal and identity base classes to reduce the amount of code required to create a custom subclass. Also made major enhancements to the MembershipIdentity class so it does pretty much everything for you in terms of authentication and loading roles from the role provider.
EditableRootListBase is now functional.
SmartDate is now functional.
NameValueListBase is now functional.
Validator control (080801)
The Csla.Wpf.Validator control provides a visual UI cue about when a control contains an invalid value (including error, warning and information severity messages).
The ClientContext, GlobalContext and User values should now flow through the data portal as they do in .NET.
There are now some new base classes in Csla.Security to make it easier to create custom identity objects. These include CslaIdentity and MembershipIdentity. The BusinessPrincipalBase class automatically works with these classes to implement IsInRole() functionality, dramatically reducing the code required to create a custom principal or identity class.
There’s also a WindowsIdentity class in Csla.Silverlight.Security to assist in retrieving the Windows user identity (and Windows groups) from the ASP.NET web server hosting the data portal. If that server is configured to require Windows authentication and does impersonation in ASP.NET, this allows the Silverlight application to use the Windows username and roles from the server on the client.
Unit tests (080715)
The cslalighttest project now has a dependency on UnitDriven, an open-source unit test framework that extends nunit and MSTest. UnitDriven is a spin-off effort from building CSLA Light, and is available at www.codeplex.com/UnitDriven.
The specific UnitDriven assemblies required by cslalighttest are part of the cslalighttest release download, or you can get them from CodePlex, or you can get them from svn://svn.lhotka.net/csla/trunk/Dependencies.
Added initial support for custom authentication. The model is the same as with CSLA .NET, where you create your own custom principal and identity classes, and use the data portal to load the identity class with user and role information on the server.
Added support for async validation rules. These rules are started along with normal rule methods, but run asynchronously. The rule method is responsible for calling back into CSLA when the rule completes, so an appropriate PropertyChanged event can be raised by the business object. The rule method is responsible for ensuring that the callback occurs on the UI thread.
Added support for validation rules equivalent to that in CSLA .NET.
Add missing overload of
Read-Only Base Classes (080707)
Base implementation of ReadOnlyBase and ReadOnlyListBase for serialization added, along with associated cloning and data portal tests.
Base classes (080626)
All primary base classes used to create business objects exist, at least in shell form. BusinessBase, BusinessListBase and CriteriaBase support serialization (cloning and travel through the data portal).
ReadOnlyBase, ReadOnlyListBase, NameValueListBase, EditableRootListBase and CommandBase are incomplete shells.
BusinessBase does not yet support validation or authorization, but does support both managed and private backing fields for properties.
Added a MobileFormatter, which provides limited capabilities like the BinaryFormatter, but works in Silverlight and .NET. This formatter is used by the CSLA Light data portal to transfer objects to/from a .NET app server.
MobileFormatter support includes the introduction of IMobileObject, and a Serializable/NonSerialized attribute definitions similar to those in .NET.
Support for the MobileFormatter exists in most Serializable classes within CSLA Light so they are able to serialize their private fields without reflection as required by Silverlight and the MobileFormatter.
Business objects that only use managed backing fields are serialized automatically. Business objects that use private backing fields must override OnGetState() and OnSetState() methods to get/set their private backing fields into the serialization data stream.
Data Portal (080626)
The CSLA Light data portal supports Create/Fetch/Update/Delete operations. The data portal uses an asynchronous call pattern just like all other Silverlight technologies for calling a server. This means the data portal works differently from the one in CSLA .NET, but still provides the same conceptual behavior. Here’s how to invoke the data portal to create an object:
var dp = new DataPortal<Customer>();
dp += dp_CreateCompleted; // callback event
Then you must implement the callback event handler to handle the result:
private void dp_CreateCompleted(
object sender, DataPortalResult<Customer> e)
if (e.Error != null)
// process exception
this.DataContext = e.Object; // use result
Alternately you can use a lambda to shorten the code to this:
var dp = new DataPortal<Customer>();
dp += (o, e) =>
if (e.Error != null)
// process exception
this.DataContext = e.Object; // use result
The data portal supports both local (3-tier) and remote (4-tier) modes.
The local mode runs DataPortal_XYZ methods in the objects on the Silverlight client. This allows you to write methods like DataPortal_Fetch() that run on the client so you can manually call remote services as you choose. For instance, you could use this technique to retrieve data from a server running ADO.NET Data Services for the Web, and use the results to populate your object graph with data.
The remote mode uses WCF as the network transport to communicate with a CSLA .NET data portal running on a .NET web server. The CSLA .NET data portal is not the “normal” data portal, but is a new data portal in CSLA .NET 3.6 designed to support a CSLA Light client. See the Csla.Server.Hosts.Silverlight namespace for the code. The service contract to expose is IWcfPortal, and the service implementation is WcfPortal.
With a remote data portal your object would be loaded on the server using normal CSLA .NET techniques (again, in a DataPortal_XYZ method – but one running in .NET on your servers).
The remote data portal operates in two possible modes. One mode is a passthrough, where each CSLA Light call is simply passed through to the CSLA .NET data portal, and the result is transparently returned. This is appropriate when the Silverlight client is trusted, and you want the simplest and most “CSLA like” experience.
The other mode will invoke an “observer” object on the .NET server so you can examine the inbound client request (the objects sent to the server from the client) before allowing further processing. To do this, the root business class should have the MobileFactory attribute applied to specify the type name and methods for the observer object.
Silverlight does not currently have a good configuration story. At the moment, the data portal is configured through code by your client application. Typically you’ll configure the data portal once, as the application starts running. You can use the following settings:
Csla.DataPortal.ProxyTypeName = "Local"; // or "WcfProxy"
"http://myserver/mysite/service.svc"; // URL to .NET data portal
new BasicHttpBinding(); // WCF binding, BasicHttpBinding is default
The end result is that you can specify whether to run the data portal locally or over WCF, and if you choose WCF you can specify the URL and (optionally) the binding to the remote server.
N-level Undo (080626)
BusinessBase and BusinessListBase support n-level undo in Silverlight just like in .NET. the BeginEdit(), CancelEdit() and ApplyEdit() methods work the same as they do in CSLA .NET.
There is no support for IEditableObject, because that interface doesn’t exist in Silverlight. This means that n-level undo is only used if you use it. There is no overhead to its existence unless you call BeginEdit() in your code.
The n-level undo functionality does need to do a type of serialization of object data – it relies on the Memento design pattern. The approach taken in CSLA Light uses the same serialization scheme as the MobileFormatter, so a business object author that makes their object work with the MobileFormatter automatically supports n-level undo. No extra effort is required unless you use private backing fields in your objects.
Change all <P, F> overloads to include the word ‘Convert’. For example, GetProperty<P,F> is now GetPropertyConvert<P,F>. This avoids an ambiguity scenario and allows the compiler to do better type inference.
Unit testing (080626)
While there is a Microsoft-supplied unit testing framework for Silverlight, it doesn’t support tests against asynchronous methods. This meant we had no way of testing the data portal behaviors in CSLA Light. Unfortunately Microsoft’s framework source isn’t available, so we were unable to enhance it.
To resolve this issue, the cslalighttest project includes an nunit-like unit testing engine. This engine is a subset of what you might expect in other testing frameworks, but it is sufficient for executing unit tests against Silverlight code, and it supports testing asynchronous methods.