State management

There are 4 different state management modes. They affect the behavior of the Importer control and the ObjectGateway control. The following sub-sections describe these 4 modes.

Note:

In the current version of the CSO Gateway, only the default mode, UpdateOnInputChange is available. Other modes will be implemented in future versions.

This section contains the following subsections.

UpdateOnInputChange (default)

When this mode is used, the Importer control will update its state and save it in the Control State of the page. This will happen when:

  • it is the initial load of the page
  • it is a post back and any of the ObjectGateway control on the page had a cso-compatible object re-assigned to its SourceObject property during the current post back.
Otherwise the Importer control will render its output based on what is stored in the control state.

The state of the Importer control is the script Dependency Graph, that is, a set of script identifiers and a set of dependencies between them. The Importer control will update its state by merging the Dependency Graph stored in the control state with the new Dependency Graph for the current request. The merge is acheived by making the union of the two sets of vertices (scripts identifiers) and the union of the two sets of edges (script dependencies).

The ObjectGateway control will update its state and save it in the Control State of the page. This will happen when:

  • it is the initial load of the page
  • it is a post back and the ObjectGateway control had a cso-compatible object re-assigned to its SourceObject property during the current post back.
The state of an ObjectGateway control is an exact value-creation-script string. The ObjectGateway control updates its state by re-calculating the value-creation-script output with new new object assigned to its SourceObject property.

When this mode is used, the initial assigment of the cso-compatible object to the SourceObject property, if there is one, should be done inside a !IsPostBack block:

C# Copy
if(!IsPostBack)
{
	objectGateway1.SourceObject = myCsoCompatibleObject;
}
		
. If not, the Importer control and the ObjectGateway control will recalculate their output on each post-back even if their state is not touched.

UpdateValuesOnInputChange

Note:

This mode is not implemented yet. It will be the same as the UpdateOnInputChange mode but only the ObjectGateway controls will be updated not the Importer control.

NeverUpdate

Note:

This mode is not implemented yet. With this mode, the Import and Object Gateway controls will never recalculate their output. It will be stored in the control state on the first hit and this will be reused to render the controls on all future post-backs

AlwaysUpdate

Note:

This mode is not implemented yet. This mode will be the only one the work without the control state and the view state enabled. With this mode, the output of the Importer and ObjectGateway controls will be re-calculated on each postback. This means that the source objects will have to be assigned to their ObjectGateway control on all post-backs.

Conversion of .NET framework types to javascript types

This section contains the following subsections.

Type conversion table

In the table below is a list of all the .NET Framework types handled by the CSO Gateway in its default configuration together with the javascript type used to convert them.

Type Javascript type Comments
Special cases - -
<null value> Null -
<any enum type> <a cso-generated enum> -
Primitive types - -
System.Boolean Boolean -
System.SByte Number -
System.Int16 Number -
System.Int32 Number -
System.UInt32 Number -
System.Int64 Number Range limited. See ToClientSideConfigElement..::.ExceptionOnPrecisionLossInt64
System.UInt64 Number Range limited. See ToClientSideConfigElement..::.ExceptionOnPrecisionLossUInt64
System.Char String -
System.Double Number -
System.Single Number -
Commonly used structures - -
System.String String -
System.Array Array N-dimensional arrays are supported. Contructor of Array Intrinsic object is used.
System.DateTime Date Date is an Intrinsic object not a data type. Underlying data type is Number.
System.Decimal Number Range limited. See ToClientSideConfigElement..::.ExceptionOnPrecisionLossDecimal
System.Guid String Output format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
System.TimeSpan CsoGateway.System.TimeSpan -
Collections - -
System.Collections.ArrayList CsoGateway.Collections.List -
System.Collections.Specialized.StringCollection CsoGateway.Collections.List -
System.Collections.BitArray CsoGateway.Collections.List -
System.Collections.Hashtable CsoGateway.Collections.Dictionary -
System.Collections.Specialized.HybridDictionary CsoGateway.Collections.Dictionary -
System.Collections.Specialized.ListDictionary CsoGateway.Collections.Dictionary -
System.Collections.Specialized.StringDictionary CsoGateway.Collections.Dictionary -
System.Collections.Queue CsoGateway.Collections.Queue -
System.Collections.Stack CsoGateway.Collections.Stack -
System.Collections.SortedList CsoGateway.Collections.SortedList -
System.Collections.Specialized.OrderedDictionary CsoGateway.Collections.SortedList -
System.Collections.Specialized.NameValueCollection CsoGateway.Collections.NameValueCollection -
Generic Collections - -
System.Collections.List`1 CsoGateway.Collections.List -
System.Collections.Generic.LinkedList`1 CsoGateway.Collections.List -
System.Collections.Generic.Dictionary`2 CsoGateway.Collections.Dictionary -
System.Collections.Generic.Queue`1 CsoGateway.Collections.Queue -
System.Collections.Generic.Stack`1 CsoGateway.Collections.Stack -
System.Collections.Generic.SortedList`2 CsoGateway.Collections.SortedList -
System.Collections.Generic.SortedDictionary`2 CsoGateway.Collections.SortedList -