In the current technical preview, the Microsoft ObjectSpaces framework consists of a set of a classes and interfaces grouped in a namespace (Microsoft.ObjectSpaces) that provide an object-oriented mapping layer to access data. This framework builds on the classes of the .NET Framework, particularly those in the System.Xml and System.Data namespaces, to provide access to both XML data sources and relational data sources. The high-level architecture of the ObjectSpaces framework can be seen in Figure 1.
Figure 1 The Microsoft ObjectSpaces architecture, adapted from the SDK documentation.
Note that ObjectSpaces provides three primary ways of abstracting data: through the DataSpace, the XmlObjectSpace, or the SqlObjectSpace classes. All three of these classes are derived from ObjectSpace, and all read and write their data to an underlying DataSet that is eventually synchronized with a persistent store such as an XML file or a database using a .NET data provider. This architecture obviously introduces some overhead, as is always the case when adding a layer of abstraction. However, because the data never actually leaves the underlying DataSet, the overhead is minimized. In contrast, entity beans typically introduce a significant amount of overhead that has sparked a debate in the IT industry on their proper use.
A DataSet is a class in the .NET Framework (ADO.NET) that provides a disconnected, XML-based, in-memory cache of data. DataSet objects are used for passing data between tiers of a distributed application.
The primary difference between the DataSpace and both the XmlObjectSpace and the SqlObjectSpace is that the DataSpace has no inherent persistent store and can simply be created from any existing DataSet. The other two objects persist their data and implement the IObjectSpace interface. They can be used polymorphically so that client code needn't be concerned with whether the data resides in XML or in a relational database. In all three cases, the actual data always resides in a DataSet that is simply mapped into and out of the object dynamically by the ObjectSpace object.
In the next article, I'll delve into the specifics and show you some code that demonstrates how ObjectSpaces provide object-oriented access to a Customers table in SQL Server 2000.