GitHub    Download    Forum
Overview
Tutorial
Database setup
Preparing the project
Establish the connection
Shut down the connection
DTDL types
Creating the schema
DADL classes
Entry point object
Write and read attributes
Write and read lists
Extending the schema
Modified entry point object
Write and read objects
Write and read object lists
C++ API
C# API
WinRT API
DTDL
DADL
Setup
C++
C#

Shut down the connection

When you wish to terminate an interaction with the storage on a server, the following functions will be needed. Again, we'll pack them all into their own function, called 'uninit'.
Now, we just need to call that function at the end of our main function as follows:
Tutorial.cpp – main function
Tutorial.cs – main function
uninit(pDomain, ulStorageId);
uninit(pDomain, ulStorageId);
First of all, we unbind all types of our DADL file with "Unbind". Next we uninitialize and destroyuninitialize and destroy the domain object. Then we release our storage and disconnect all connectionsrelease our storage and disconnect all connections. After that, we uninitialize the connection and delete ituninitialize the domain and delete it.
Last but not least, we uninitialize the threaduninitialize the thread.
uninit.cpp
uninit.cs
#include "pch.h"

void uninit(Connection*& pConnection, WDomain*& pDomain, UINT32 ulStorageId)
{
	// unbind from schema
	AccessDefinition::Unbind();

	// delete domain object
	pDomain->Uninitialize();
	Domain_Destroy(pDomain);

	// disconnect from storage
	pConnection->ReleaseAllStorages();

	// disconnect from server
	pConnection->DisconnectAll();

	// delete connection object
	pConnection->Uninitialize();
	Connection_Destroy(pConnection);

	// uninitialize thread and free libraries
	UninitializeThread();
}
using System;
using DataFSAccess;

namespace TutorialCs
{
	partial class Tutorial
	{
		public static void uninit(WDomain pDomain, UInt32 ulStorageId)
		{
			Connection pConnection = pDomain.GetConnection();

			// unbind from schema
			AccessDefinition.Unbind();

			// delete domain object
			pDomain.Uninitialize();
			WDomain.Destroy(pDomain);

			// disconnect from storage
			pConnection.ReleaseStorage(ulStorageId);

			// disconnect from server
			pConnection.DisconnectAll();

			// delete connection object
			pConnection.Uninitialize();
			Connection.Destroy(pConnection);

			// uninitialize thread and free libraries
			ThreadInit.UninitializeThread();
		}
	}
}
Now we know how to initialize and uninitialize DataFS libraries and connections. In the next steps, we will define the schema types we want to write to the database.
© 2025 Mobiland AG