SYSK 25: What happened to ObjectSpaces (object-relational mapping technology), and what is it, anyway?

For those who are not familiar with the term, ObjectSpaces refers to a technology representing an abstraction layer between business objects (strong typed classes) and a relational database, which instantiates and populates custom objects from a relational database.  It works through XML metadata stored in a mappings file that is passed to the constructor of the ObjectSpace class, which maps relational objects to .NET objects and relational types to .NET types.  Here is an example of what your code might look like using ObjectSpaces:

SqlConnection cn = new SqlConnection(connectionString);
ObjectSpace os = new ObjectSpace("CustomerMapping.xml", cn);

ObjectSet dataSet = os.GetObjectSet(GetType(Customer), "Id = 'ALFKI'");


ObjectQuery query = new ObjectQuery(GetType(Customer), "Id = 'ALFKI'");
ObjectReader reader = os.GetObjectReader(query);

foreach(Customer c in reader)
     CustID.Text = c.Id;
     CustName.Text = c.Name;
     CustCompany.Text = c.Company;
     CustPhone.Text = c.Phone;


There is much more to ObjectSpaces than what I’ve described thus far; e.g. object relationships, tracking and saving of changes, etc.  If this peeked your interest, there is a good MSDN article “A First Look at ObjectSpaces in Visual Studio 2005” --

It was suppose to ship with .NET 2.0, but didn’t make it.  It’s now planned to be released with WinFS (new relational file system for next version of Windows):

Comments (0)

Skip to main content