Bundle Library

The Bundle library contains all the model needed for an application to be compiled and executed properly, these models are used to replace the existing components within desktop components and controls into web versions of them.

The Bundle library is the one that provides the Control Models, GUI Life cycle mechanism, Application State mechanism, among others that are vital to keep the original application behavior in the back-end of the converted code.

Models

A model is a CSharp class used to represent the data of a component or control, for each original control there is an equivalent model in WebMAP. An example of this is a in Windows Forms application a System.Windows.Form class gets replaced with Mobilize.Web.Form class, which is defined as part of the Windows Form’s DCP and acts as the new applications counterpart of the original component.

Application state

The application state is known as the representation of the totality of everything needed for an application to be able to run, it is usually referring to the memory used specifically to allocated for a given program.

For a desktop environment the state of an application is commonly handled directly by a memory storage system (Windows Memory system, .NET Framework, Java Virtual Machine, etc.) which keeps allocated all its data during its whole execution in RAM memory, which means that for a given application all its data (class instances, static fields, objects, etc.) is been stored all at once while the application is been executed, however, for web application developed from scratch this is not the case, since they are commonly implemented as stateless, which means that between one a request/response and another no state is stored in memory.

In order to bring a stateful application into a stateless architecture Mobilize has developed different mechanism:

  • Desktop Compatibility Platform (DCP): is a set of libraries created to bring into a web application a compatible and equivalent behavior found in a legacy application developed in a desktop framework.

  • WebMAP.CoreServices: a mechanism created to track down object references and map them into the application’s session in order to ensure that they are available between different request/response process.

The state of each model in a WebMap application needs to implement a tracking mechanism which is provided by the WebMAP.CoreServices library so it can adequately handle its reference count to ensure the object gets persisted in the application's current session. In order to do so the Observable and Intercepted attributes are used to mark model's classes and properties respectively.

  • Observable attribute: used to mark a model class as Observable; this means that this class contains properties that need to be tracked down by the WebMap.CoreServices mechanism. Any object marked with an Observable attribute is called Observable object.

  • Intercepted attribute: is used to mark a property as observable, this means that the WebMap.CoreServices will keep reference tracking of this object so it won't get removed by .NET framework during the garbage collection process. The interception mechanism is used by the Mapper mechanism as well, to ensure the property deltas are sent to the front-end only when they were modified, if a non-intercepted property is used in a mapper it will send its value to the front-end in every single request made. The use of intercepted properties has the following restrictions.

    • The attribute needs to be applied individually to each auto-property in an observable class. Properties that are not auto-properties (the get or set have any kind of implementation in them) cannot be marked as intercepted.

    • In order to work correctly the Intercepted attribute needs to be used in a class that is also has the Observable attribute, otherwise it won't work.

    • The type of the property needs to be a value type (int, long, string, bool, etc), another observable class or an object that has registered an Observable Wrapper or the WebMAP.CoreServices won't be able to keep track of it.

The observable and intercepted attributes need to be applied to every class and property that needs to be persisted between two or more requests, this not only include DCP model but the actual application source code.

Original code:

public class SampleClass
{
    public bool SampleProperty { get; set; }
}

Converted code:

[Mobilize.WebMap.Common.Attributes.Observable]
public class SampleClass
{
    [Mobilize.WebMap.Common.Attributes.Intercepted]
    public bool SampleProperty { get; set; }
}

Last updated