NPersist Example Code, VB.NET
Visual Basic.NET:
Dim Context As New Context("C:\MyDomain.npersist")
Dim emp As New Employee()
Context.CreateObject(emp)
Employee.FirstName = "Mats"
Employee.LastName = "Helander"
Context.PersistAll()
MsgBox("New employee ID: " & emp.ID)
Dim emp2 As Employee
emp2 = Context.GetObject(emp.ID, GetType(Employee))
If emp Is emp2 Then
MsgBox("Uniquing works!")
Else
MsgBox("Uniquing failed!")
End If
emp.FirstName = "Some"
emp.LastName = "Guy"
'(which means updated...)
Context.PersistAll()
Context.DeleteObject(emp)
Context.PersistAll()
'"NPath" object/query language:
Dim npath As New NPathQuery( _
"Select * From Employee Where " & _
"(FirstName = 'Mats' And " & _
"LastName = 'Helander') Or " & _
"FirstName LIKE 'A%' Order By LastName"
Dim employees As ArrayList
employees = Context.GetObjects( _
npath, _
GetType(Employee))
For Each emp In employees
MsgBox(emp.Company.Name)
MsgBox(emp.Company.Address.Country.CapitalCity.Name)
Next
Context.Dispose()
google search optimization price . Buy Provillus . Find unique glass pipes & color changing glass pipes worldwide.
|