Siaqodb stores its data in a file called "data.mdb" within a specified folder on disk. As a best practice we recommend opening a database only once and then using that database instance throughout your application runtime. The examples below show factory classes that create and open Siaqodb database instances for each platform supported.

Setting your License

Licensed versions of Siaqodb require a license code in order to function. Add the following code before you perform other database actions to activate your license:

Sqo.SiaqodbConfigurator.SetLicense("[Paste your provided license key here...]");

Custom Folder Name

You may customize the folder name for your database storage file by passing the folder name into the main Siaqodb constructor. The SiaqodbFactory example shows how to customize this path.

SiaqodbFactory: Full Example

class SiaqodbFactory
{
    public static string siaoqodbPath;
    private static Siaqodb instance;
    ///<summary>
    /// Set the path where the database file will reside
    ///</summary>
    public static void SetPath(string path)
    {
        siaoqodbPath = path;
    }
    ///<summary>
    /// Acquire an instance of the database engine
    ///</summary>
    public static Siaqodb GetInstance()
    {
        if (instance == null)
        {
            instance = new Siaqodb(siaoqodbPath);
        }
        return instance;
    }
    ///<summary>
    /// Close the database
    ///</summary>
    public static void CloseDatabase()
    {
        if (instance != null)
        {
            instance.Close();
            instance = null;
        }
    }
}

.NET

SiaqodbFactory.SetPath("D:\databases\sdb");
var sqo = SiaqodbFactory.GetInstance();

SiaqodbFactory: WindowsStore OR WindowsPhone

SiaqodbFactory.SetPath(Windows.Storage.ApplicationData.Current.LocalFolder.Path);
var sqo = SiaqodbFactory.GetInstance();

SiaqodbFactory: Xamarin.iOS

SiaqodbFactory.SetPath(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
var sqo = SiaqodbFactory.GetInstance();

SiaqodbFactory: Xamarin.Android

SiaqodbFactory.SetPath(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
var sqo = SiaqodbFactory.GetInstance();

Using the SiaqodbFactory Instance

Now that we have a static instance, let's create, update and delete an object in the Siaqodb database:

SiaqodbFactory.SetPath("D:\databases\sdb");
var 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);

Custom Database Size and Type Limits

You may specify the maximum size and types to be stored in your database when it is constructed. The following example will construct a database with a maximum size of 100MB and a maximum of 50 different object types allowed (100/2).
Note, if you do not specify anything here, the database will have a maximum size of 50MB and will be able to contain 25 different types.

Siaqodb sqo = new Siaqodb(objPath, 100 * 1024 * 1024, 100)