ObjectSpace中说明文档的不足!
using System;
using Microsoft.ObjectSpaces;

//
// ObjectSpaces object 'Customer'.
//
public abstract class Customer 

{
[UniqueId] public abstract string Id
{ get; set; }

public abstract string Name
{ get; set; }
public abstract string CompanyName
{ get; set; }
public abstract string Phone
{ get; set; }
public abstract string Fax
{ get; set; }
public void OnCreate(string newId) 
{
Id = newId;
}
}

//
// ObjectSpaces Tutorial #1
//
public class Example2 

{
public static void Main() 
{
try 
{
//
// Load in the Source.xml file (specifies the XmlObjectSpace to load in).
//
IObjectSpace os = ObjectSpaceFactory.CreateObjectSpace("Source.xml");

//
// Create two new customers.
//
Customer myCustomer = (Customer) os.CreateObject( typeof(Customer), "1" );
myCustomer.Name = "Mario Esprito";
myCustomer.CompanyName = "Infoltrix";
myCustomer.Phone = "(111) 345 6777";
myCustomer.Fax = "(222) 343 6744";
myCustomer = (Customer) os.CreateObject( typeof(Customer), "2" );
myCustomer.Name = "Frank Antuono";
myCustomer.CompanyName = "Infoltrix";
myCustomer.Phone = "(333) 345 6737";
myCustomer.Fax = "(444) 343 6244";

//
// Once you have specified values for the fields, commit the changes to
// the underlying object storage.
//
os.UpdateAll();

//
// Iterate through the newly created objects in the ObjectSpace and
// print out object properties.
//
foreach(Customer theCustomer in os.GetObjects(typeof(Customer), "")) 
{
Console.WriteLine(" Customer Id: " + theCustomer.Id +
" Customer Name: " + theCustomer.Name +
" Company: " + theCustomer.CompanyName +
" Phone: " + theCustomer.Phone +
" Fax: " + theCustomer.Fax + " " );
}
}

//
// Catch any exceptions that might occur.
//
catch (Exception e) 
{
Console.Write(e);
}
}
}其中 Customer myCustomer = (Customer) os.CreateObject( typeof(Customer), "1" );
感觉文档中说得不太清楚!VS2003的ObjectSpace文档感觉写得太烂,很多细节都忽略了!
