GitHub    Download    Forum
Overview
How to start
Download
Concepts
Detailed concepts
15 | Transactions
16 | Object Checklist
17 | Linking Objects
25 | ACID Transaction Concept
Tutorial
C++ API
C# API
WinRT API
DTDL
DADL
Setup

DataFS Code - Object Checklist

Working with DataFS Objects

When working with objects we always have to do a few crucial steps in order to save and retrieve it to and from our database.
This checklist is a short summary valid for every object and should help us to keep track of the steps, that have to be done in that particular order.

Create an Object

    Allocate some space for the object
    WSomeObject* pSomeObject = NULL;
    
    Create the object
    WSomeObject::Create(&pSomeObject, pParentObject);
    
    Link the object (more here)
    pParentObject->LinkSomeObject(pSomeObject); //sustaining link
    pParentObject->SetSomeObject(pSomeObject); //lazy-link
    pParentObject->SetUnspecifiedObject(&pSomeObject->BuildLink(true)); //sustaining link
    pParentObject->SetUnspecifiedObject(&pSomeObject->BuildLink(false)); //lazy-link
    pDomain->InsertNamedObject(&pSomeObject->BuildLink(true), &guidEntryPoint, L"someEntryPoint");
    //Entry-Point-Link
    
    Continue to "Store an Object"-Section ...

Load an Object

    Allocate some space for the object
    WSomeObject* pSomeObject = NULL;
    
    Open the Object by either
      Find the ObjectID (more here)
      DataFoundation::ObjectId oi;
      pDomain->QueryNamedObjectId(&guidEntryPoint, 1, &oi);
      Open the Object
      WSomeObject::Open(&pSomeObject, &oi, pDomain);
    OR
      Open the Object over dadl-generated function in parent object
      pSomeObject->OpenSomeChildObject(&pSomeChildObject);
    Enqueue the object to load into the transaction
    pSomeObject->Load();
    
    Execute the transaction
    pSomeObject->GetDomain()->Execute(Transaction::Load);
    
    Decide what to do with the loaded Object, either
      continue to "Store an Object"-Section....
      OR
        Read the objects attributes
        const AttributeType* pMyAttributeSetting1;
        pSomeObject->GetAttribute1(&pMyAttributeSetting1);
        Release the memory on your object
        pSomeObject->Release();

Store an Object

    ...come from either "Loading an Object"- or "Create an Object"-Section and continue here...
    Set its attributes
    pSomeObject->SetAttribute1(MyAttributeSetting1);
    
    Enqueue the object to store into the transaction
    pSomeObject->Store();
    
    Execute the transaction
    pSomeObject->GetDomain()->Execute(Transaction::Store);
    
    Release the memory on your object
    pSomeObject->Release();
    
© 2025 Mobiland AG