A detailed look at manual state management, Overview of the thematics sample – Pitney Bowes MapXtreme User Manual

Page 115

Advertising
background image

Chapter 6: Understanding State Management

A Detailed Look at Manual State Management

MapXtreme v7.1

115

Developer Guide

User State

Your application must now consider the user's current state and the state of the MapXtreme Session
object when it was retrieved from the pool. In this situation you will have to decide:

Do you return the pooled object clean to the pool in your SaveState method?

Do you let go of the pooled object and then restore any state in the RestoreState method?

The correct choice here is not always clear since many variables about the difference in state from
one user to another may lead you to leave the session object dirty prior to releasing it back to the
pool. Another application may save time by waiting for the Page_Load to clean up or to check if the
Session needs cleaning.

The example in the section

Manual State Management: A Walk-Through on page 118

followed

the second option here: to clean up the pooled object in the RestoreState method.

The next section provides more information on how to save and restore state.

A Detailed Look at Manual State Management

This section provides a detailed example of how a pooled application can perform manual state
management. We will examine relevant sections of code from the Thematics sample web
application, which is installed as part of MapXtreme. If you have not already done so, you might want
to run the Thematics sample to familiarize yourself with it, before reading this section.

The Thematic sample is one of the projects included in the solutions here:

C:\Program
Files\MapInfo\MapXtreme\7.x.x\Samples\VisualStudio20xx\Web\Features

This discussion covers the following topics:

Overview of the Thematics Sample

Application Settings

Implementing a StateManager

Serializing MapXtreme Objects in the Proper Order

Automatically Deserializing MapXtreme Objects

Handling Initial Requests

Handling Subsequent Requests

Overview of the Thematics Sample

This application displays a map of the world, loaded from the workspace World.mws (part of the
sample data installed with MapXtreme).

Advertising