Microsoft KB Archive/231416

= INFO: Remote Data Services (RDS) Objects Do Not Maintain State =

Article ID: 231416

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Plus! Game Pack: Cards & Puzzles
 * Microsoft Remote Data Services 1.1
 * Microsoft Remote Data Services 1.5
 * Remote Data Service for ADO 2.0
 * Microsoft Remote Data Services 2.0
 * Microsoft Remote Data Services 2.1
 * Microsoft Remote Data Services 2.1
 * Microsoft Remote Data Services 2.1
 * Remote Data Service for ADO 2.5
 * Remote Data Service for ADO 2.6

-



This article was previously published under Q231416



SUMMARY
When you write a custom business object designed to operate with Remote Data Services (RDS), it is important to remember that RDS objects cannot maintain state.

When RDS executes a method of an object from the client, the object is created on the server, executed (results returned to the client), and immediately destroyed.

This behavior is by design.



MORE INFORMATION
To understand why RDS creates the object to execute a single method, you must understand that the primary environment RDS was designed for was to function over the Internet. An Internet-based application has several needs to address:
 * It must be able to service a large number of users.
 * It must be able to operate in a disconnected state.

To service these requirements, an Internet Server needs to handle its resources as efficiently as possible. Consider the following example:

Joe is building an application for his salespeople. Joe would like to have his salespeople connect from anywhere and exchange information with the home office.

The Internet is the perfect medium for Joe because worldwide connectivity is cheap and plentiful. If Joe builds his application to maintain state on his server, what would happen if a salesperson logged in and didn't disconnect properly? What would happen if 100 or even 1,000 salespeople logged in, each maintaining 100k of stateful information? Server resources would be wasted and server performance would degrade.

With this information in mind, it was decided that the best route would be to design RDS to destroy the server object at the end of each method call. This does not mean you need to re-create the client-side object each time, it just means you need to remember that each time you use the client-side object, you are getting a new object on the server.

