NPersist Example Code, C#
C#:
Context Context =
new Context("C:\MyDomain.npersist");
Employee emp = new Employee();
Context.CreateObject(emp);
Employee.FirstName = "Mats";
Employee.LastName = "Helander";
Context.PersistAll();
MessagegBox.Show("New employee ID: " + emp.ID);
Employee emp2;
emp2 = Context.GetObject(emp.ID, typeof(Employee));
if (emp == emp2) {
MessageBox.Show("Uniquing works!");
} else {
MessageBox.Show("Uniquing failed!");
}
emp.FirstName = "Some";
emp.LastName = "Guy";
//(which means updated...)
Context.PersistAll();
Context.DeleteObject(emp);
Context.PersistAll();
//"NPath" object/query language:
NPathQuery npath = new NPathQuery(
"Select * From Employee Where " +
"(FirstName = 'Mats' And " +
"LastName = 'Helander') Or " +
"FirstName LIKE 'A%' Order By LastName";
ArrayList employees;
employees = Context.GetObjects(
npath,
typeof(Employee));
foreach (Employee empl In employees) {
MessageBox.Show(empl.Company.Name);
MessageBox.Show(
empl.Company.Address.Country.CapitalCity.Name);
}
Context.Dispose();
Toronto e s c o r t s . batterie HTC Rezound 1900 mah . We bet you never thought about such an amount of different bets movies existence.
|