Rockford Lhotka
    CTO at Magenic
    Author, speaker, software architect
    Creator of the CSLA .NET framework

Home
Blog
CSLA .NET
Magenic
Speaking
Publications
About me
Contact me

Login

Version 4.3 change log

 

This document is the change log for CSLA 4 version 4.3.

 

CSLA 4 version 4.3 includes support for:

 

·         Microsoft .NET 4

·         Silverlight 5

·         Silverlight 4

·         Windows Phone 7.5

·         Mono www.xamarin.com

·         Mono for Android www.xamarin.com

 

Note: The source code for this release includes early WinRT code. However, you should use the CSLA 4 version 4.5 or higher code for any work in WinRT.

 

Release 4.3.13-120710:

 

Note: The setup project installs the Silverlight 4 assemblies in the Program Files bin folder in a Silverlight4.zip file. If you want to reference those assemblies you will need to unpack that zip file.

 

Issue

Description

1074

When using PropertyInfo inside a ControlTemplate, metadata sometimes does not update properly when binding changes

 

Release 4.3.12-120607:

 

Note: The setup project installs the Silverlight 4 assemblies in the Program Files bin folder in a Silverlight4.zip file. If you want to reference those assemblies you will need to unpack that zip file.

 

Issue

Description

1061

Add support for PowerShell scripts to create "PreRelease" NuGet packages

 

Beta 4.3.11-120529:

 

Note: The setup project installs the Silverlight 4 assemblies in the Program Files bin folder in a Silverlight4.zip file. If you want to reference those assemblies you will need to unpack that zip file.

 

Issue

Description

1055

Add IDataPortal interface

1054

Add IBusinessBase interface

1053

Make GetRegisteredProperties functionality public

1052

Add ICheckRules.GetBrokenRules in order to get the BrokenRules collection of a BO

1049

PropertyInfo control sometimes errors when the bound property is part of a long binding path

1048

Using PropertyInfo inside a ControlTemplate is not working correctly with ComboBox controls

1047

Fix race condition bug with MethodCaller

1046

Update NuGet packages to support publishing debugging symbols and source code to SymbolServer.org

1045

Throw descriptive exception when property name can't resolve to IPropertyInfo

1044

Add support for using (SupressListChanged) to <bo> list base classes

1043

Make it easier to suppress list changed events

1040

Consider make OnSaved event virtual

1039

Fix possible invalid cast exception in MobileFormatter

1038

BusinessListBase - SetItem must use NotifyCollectionChanged.Replace

1033

Csla.Server.DataPortal does not honor attributes on ObjectFactory portal

1032

Fix bug with NuGet .NuSpec file using incorrect profiles for Windows Phone and others

991

Investigate issue with controller SaveObject not creating objects correctly

989

Improve exception message when child data portal can't find matching method

951

Fix issue where save handler is called while object is busy in SL

899

Enhance Min/MaxValue rules to work better with nullable types

843

Fix CslaActionExtender issue in OnObjectSaving

743

Add RefreshOnException property to BindingSourceRefresh

700

CslaActionExtender doesn't rebind if there's an error

650

Consider enhancing CslaActionExtender

426

Investigate problem with CslaActionExtender when first saving doesn't succeed

 

 

Release 4.3.10-120304:

 

Note: The setup project installs the Silverlight 4 assemblies in the Program Files bin folder in a Silverlight4.zip file. If you want to reference those assemblies you will need to unpack that zip file.

 

Issue

Description

1028

Update ProjectTracker to use new serialization in 4.3

1027

Update WinRT project to support the Consumer Preview

1026

Add lock on ClearRules in BusinessRules

1025

IsBusy is NonSerializable - so should net be included in OnSetState/OnGetState on BusinessRules

1023

Add WfUI (Windows Forms UI) to ProjectTracker

1022

Lamda rule must expose AddQueryParameter for Lambda extensions to add Query Parameter and make unique RuleName

 

 

Beta 4.3.2-120215:

 

There is now a \Silverlight4 folder for the debug and release builds that contains version 4.3 built for Silverlight 4.

 

The \Silverlight folder contains version 4.3 built for Silverlight 5.

 

Changes:

Issue

Description

1021

Add SL4 support in version 4.3

 

 

Beta 4.3.1-120213:

 

The Silverlight assemblies are now bound to Silverlight 5 and will no longer work in Silverlight 3 or 4 projects.

 

Changes:

Issue

Description

1019

PropertyInfoManager - when adding properties should not use InvariantCultureIgnoreCase

1014

Allow InputProperties to handle LazyLoaded properties that are not initilized yet

1013

Update samples for 4.3

1012

Remove Browsable attribute from Csla.Wp

1011

ReadProperty doesn't check LazyLoad flag correctly

1010

Update Silverlight projects for Silverlight 5

1008

CheckObjectRules must aggregate all affected properties

1007

CheckRules - only need to check rules for properties that has rules

 

 

Alpha 4.3.0-120126:

 

There are a number of bug fixes and several feature changes – see the list of issues below.

 

The big change is the addition of a new serialization optimization for MobileFormatter. This applies to Silverlight and Windows Phone applications, and can result in a substantial reduction in the amount of data sent over the network between client and web/application server. See the detailed discussion after the change log.

 

Changes:

Issue

Description

1005

Bug in BusinessBase.BeginSave(bool forceUpdate)

1004

UndoableHandler should ignore readonly properties in Undo operations

1003

RuleContext should implement ExecuteRule method for inner rules

1002

Prevent INotifyDataErrorInfo from compiling in iOS

1000

Update UnitTests to run correct when computer has non-English culture.

999

IDataPortalResult shold provide access to UserState

998

DataPortal should check same permission for DataPortal_XYZ and ObjectFactory

995

Add constructor overload to AuthorizationContext for Unit Tests

994

Make programming consistent for AuthorizationRule.CacheResult and BusinessRule.IsAsync

993

RuleResult should set Seveity = RuleSeverity.Success when result is Success (no error/warn/info set in Execute)

984

Create CslaFormatter that is more efficient than MobileFormatter

982

Add better exception message to RuleContext.AddOutValue

962

Load DataAnnotations from class and from metadata type

959

Add support for WinRT

952

Investigate issue with InitializePerTypeRules and inheritance

932

Fix timing issue in DLB SaveItem method

914

Fix issue with PropertyInfo list sorting differently based on culture

912

Update ProjectTracker for ebook series

906

Enhance CommonRules to optionally get description text from a resource file

902

Add more shortcut options for SmartDate text parsing

890

Add IManageProperties to CommandBase

 

Changes to Csla designed to improve data portal performance in Silverlight and Windows Phone 7 applications

 

Background

If you were to look at the Csla for Silverlight code after its initial release, specifically at the serialization code, you would notice the following work flow.  All Csla objects are serialized into a list of SerializationInfo objects that are designed to preserve objects structure and data through the process of exchanging the data between client and server.  Those list were serialized using DataContractSerializer and XmlWriter / XmlReader combinations.  This workflow was later improved by employing XmlBinaryReader and XmlBinaryWriter that could be created using XmlDictionaryReader and XmlDictionaryWriter classes.  This resulted in performance boost over the wire because binary serialization was more efficient than Xml Serialization.  Regardless, you can only do so much if you are using DataContractSerialization.  Recently, a blog was posted, improving performance further by modifying SerializationInfo and MobileFormatter objects.  This approach still uses DataContractSerializer, but eliminates some of the duplicate namespaces in resulting xml.

 

Research and Suggested solution

More research was done, trying to further improve performance, but DataContractSerializer was a bottleneck when all said and done.  One of the Csla users, Timothy Baldbridge (I hope I got the name right), suggested a different approach, using custom serialization specially designed for SerializationInfo objects.  This is the approach that was recently pursued, post 4.2 release.  MobileFormatter, which was responsible for both converting Csla objects into a list of SerializationInfo objects and actual serialization into a byte array and/or stream was broken down.  It is now not responsible for serialization any longer.  Instead, it delegates that process into a pair of new interfaces ICslaReader and ICslaWriter classes.  For backwards compatibility, four existing classes were written that mimic the original behavior of using XmlReader/XmlWriter or XmlBinaryReader/XmlBinaryWriter in conjunction with DataContractSerializer.  With this infrastructure in place, two ne classes were created, CslaBinaryReader and CslaBinaryWriter.  Those classes were specifically designed to serialize SerializationInfo object lists into a stream in the most efficient manner.  Not only all data types were handled individually, but also duplicate internal strings, such as property names were eliminated and replace with integers, using dictionary of string/int.  Because we have to know about all the types we could serialize, we had to create an enumeration of known Csla property types.  Here is the enumeration.  Please review your code to make sure new solution will handle your property types without issues.


namespace Csla.Serialization.Mobile
{
         
/// <summary>
         
/// This enumeration contains the list of known types
         
/// that <see cref="CslaBinaryReader"/> and <see cref="CslaBinaryWriter"/>know about
         
/// </summary>
         
public enum CslaKnownTypes : byte
          {
                   
/// <summary>
                   
/// Boolean
                   
/// </summary>
                    Boolean = 1,
                   
/// <summary>
                   
/// Character/char
                   
/// </summary>
                    Char = 2,
                   
/// <summary>
                   
/// Signed byte
                   
/// </summary>
                    SByte = 3,
                   
/// <summary>
                   
/// Byte
                   
/// </summary>
                    Byte = 4,
                   
/// <summary>
                   
/// Short /Int 16
                   
/// </summary>
                    Int16 = 5,
                   
/// <summary>
                   
/// Unsigned short / Int 16
                   
/// </summary>
                    UInt16 = 6,
                   
/// <summary>
                   
/// Integer / Int32
                   
/// </summary>
                    Int32 = 7,
                   
/// <summary>
                   
/// Unsigned Integer / Int32
                   
/// </summary>
                    UInt32 = 8,
                   
/// <summary>
                   
/// Long / Int64
                   
/// </summary>
                    Int64 = 9,
                   
/// <summary>
                   
/// Unsigned Long / Int64
                   
/// </summary>
                    UInt64 = 10,
                   
/// <summary>
                   
/// Single / single precision floating point
                   
/// </summary>
                    Single = 11,
                   
/// <summary>
                   
/// Double / double precision floating point
                   
/// </summary>
                    Double = 12,
                   
/// <summary>
                   
/// Decimal
                   
/// </summary>
                    Decimal = 13,
                   
/// <summary>
                   
/// Date / time 
                   
/// </summary>
                    DateTime = 14,
                   
/// <summary>
                   
/// String
                   
/// </summary>
                    String = 15,
                   
/// <summary>
                   
/// TimeSpan - time span
                   
/// </summary>
                    TimeSpan = 16,
                   
/// <summary>
                   
/// Date/time plus time zone / DateTimeOffset
                   
/// </summary>
                    DateTimeOffset = 17,
                   
/// <summary>
                   
/// Globally unique identifier / Guid
                   
/// </summary>
                    Guid = 18,
                   
/// <summary>
                   
/// Array of bytes. can be used to represent images data
                   
/// </summary>
                    ByteArray = 19,
                   
/// <summary>
                   
/// Array of characters, not the same as string
                   
/// </summary>
                    CharArray = 20,
                   
/// <summary>
                   
/// List of integer / List(of Int)
                   
/// Used internally for serialization of list based objects
                   
/// such as BusinessListBase
                   
/// </summary>
                    ListOfInt = 21,
                   
/// <summary>
                   
/// Represents null value
                   
/// </summary>
                    Null = 22,
                   
/// <summary>
                   
/// Represents string that is supported by internal dictionary
                   
/// that is used to replace strings with integers to save space
                   
/// in the serialization process.  This entry contains both string and 
                   
/// integer value of that string.  This data is used to re-build the 
                   
/// dictionary on the receiving end
                   
/// </summary>
                    StringWithDictionaryKey = 23,
                   
/// <summary>
                   
/// Key that corresponds to internally used string.  On the receiving end this
                   
/// value will be replaces with the actual string
                   
/// </summary>
                    StringDictionaryKey = 24
          }
}

 

In order to provide a way to configure Silverlight and Phone XAML application to use new classes, new configuration settings were added.

If you would like to use new CslaBinaryReader/Writer classes, you have to add the following to your web.config:

 

<appSettings>
    <add key="CslaWriter" value="Csla.Serialization.Mobile.CslaBinaryWriter, Csla"/>
    <add key="CslaReader" value="Csla.Serialization.Mobile.CslaBinaryReader, Csla"/>
</appSettings>

 

… and to your App.Xaml.cs:

 

private void Application_Startup(object sender, StartupEventArgs e)
{
    Csla.Serialization.Mobile.
CslaReaderWriterFactory.SetCslaReaderType(
        typeof(Csla.Serialization.Mobile.CslaBinaryReader));
    Csla.Serialization.Mobile.
CslaReaderWriterFactory.SetCslaWriterType(
        typeof(Csla.Serialization.Mobile.CslaBinaryWriter));
}

 

Of course, if you prefer the old behavior, there is a way to support that as well.  If you use XmlBinaryReader/Writer, here are the settings in web.config:

 

<appSettings>
    <add key="CslaWriter" value="Csla.Serialization.Mobile.CslaXmlBinaryWriter, Csla"/>
    <add key="CslaReader" value="Csla.Serialization.Mobile.CslaXmlBinaryReader, Csla"/>
</appSettings>

 

… and App.Xaml.cs:

                                                    CslaReaderWriterFactory.SetCslaReaderType(typeofCslaXmlBinaryReader));
                                                    
CslaReaderWriterFactory.SetCslaWriterType(typeof(CslaXmlBinaryWriter));

 

If you prefer the original approach with XmlReader/Writer, here are the settings for that in web.config:

 

<add key="CslaWriter" value="Csla.Serialization.Mobile.CslaXmlWriter, Csla"/>
<add key="CslaReader" value="Csla.Serialization.Mobile.CslaXmlReader, Csla"/>

 

… and App.Xaml.cs:

 

CslaReaderWriterFactory.SetCslaReaderType(typeof(CslaXmlReader));

CslaReaderWriterFactory.SetCslaWriterType(typeof(CslaXmlWriter));

 

Because Csla now exposes new interfaces, you are now free to write your own pair of ICslaReader/ICslaWriter classes and totally customize how your data flows across the wire.

 

Finally, here is the information collected in Fiddler with all three approaches.  The first five calls use new CslaReader/Writer classes.  The next five calls use XmlBinaryReader/Writer.  The last five calls use original XmlReader/Writer classes.  As you can see, there is significant improvement in terms of message sizes between new and old approaches.  You are fetching large lists, performance gains become even larger.  On top of message sizes, Csla will also use less memory for serialization / deserialization and likely be a little less CPU intensive.

 

 

 

(Updated 7/10/2012 11:24:29 AM)