public static void Main() { ActiveRecordStarter.Initialize( new XmlConfigurationSource("../appconfig.xml"), typeof(Company), typeof(Client), typeof(Firm), typeof(Person) ); // If you want to let AR to create the schema ActiveRecordStarter.CreateSchema(); // Common usage Client.DeleteAll(); Firm.DeleteAll(); Company.DeleteAll(); using(new SessionScope()) { Company company = new Company("Stronghold"); company.Create(); Firm firm = new Firm("Johnson & Norman"); firm.Create(); Client client = new Client("hammett", firm); client.Create(); } // Now let's load using(new SessionScope()) { Company[] companies = Company.FindAll(); Debug.Assert(companies.Length == 3); Firm[] firms = Firm.FindAll(); Debug.Assert(firms.Length == 1); Client[] clients = Client.FindAll(); Debug.Assert(clients.Length == 1); } // Drop the schema if you want // ActiveRecordStarter.DropSchema(); }
public Client(string name, Firm firm) : base(name) { _firm = firm; }