Siaqodb has a very simple API for CRUD operations. You can Create, Retrieve, Update and Delete database objects with just one line of code.

First let's define the class:

public class Employee
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTime HireDate { get; set; }
    public int Age { get; set; }
    public int OID { get; set; }
}

Now let's create, update and delete an object in the Siaqodb database:

Siaqodb siaqodb = SiaqodbFactory.GetInstance();

Employee employee = new Employee();
employee.FirstName = "John";
employee.LastName = "Walter";
employee.Age = 31;
employee.HireDate = new DateTime(2008, 10, 12);

//insert will occur
siaqodb.StoreObject(employee);

employee.Age = 32;

//update will occur
siaqodb.StoreObject(employee);

//delete will occur
siaqodb.Delete(employee);

Siaqodb CRUD operations are elegantly simple!

Now let's see how Siaqodb handles nested objects in CRUD operations. We will define a new Company class and add a Company property to the existing Employee class:

public class Company
{
    public string Name { get; set; }
    public string Address { get; set; }
    public string Phone { get; set; }
    public int OID { get; set; }

}
public class Employee
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTime HireDate { get; set; }
    public int Age { get; set; }

    public Company Employer{get;set;}

    public int OID { get; set; }
}

Now we can create a Company object and assign it to the Employer property. When we then save the Employee object, the Siaqodb engine saves both the Employee and Employer as two separate database objects of type Employee and type Company respectively.

Siaqodb siaqodb = SiaqodbFactory.GetInstance();

Company company = new Company();
company.Name = "MyCompany";

Employee employee = new Employee();
employee.FirstName = "John";
employee.LastName = "Walter";
employee.Age = 31;
employee.HireDate = new DateTime(2008, 10, 12);
employee.Employer=company;

//insert will occur and two objects will be inserted, first the company object and then the employee object
siaqodb.StoreObject(employee);

if we do:

siaqodb.StoreObject(company);
siaqodb.StoreObject(employee);

When parent objects are stored, the parent is created or updated as before. The Siaqodb engine also automatically creates or updates all nested objects in the graph – regardless of the depth of the object graph. However, when a parent object is deleted nested objects are not automatically deleted. For example calling:

siaqodb.Delete(employee);

will only delete the Employee. The Company referenced by the Employer property is not deleted. If the user wishes to delete nested objects, each object must be deleted explicitly. Future releases of Siaqodb may include an option to automatically cascade delete operations to all nested objects.