ConnectorLib .NET 25.2
ConnectorLib .NET SDK Programming Guide

# Create a DatastoreFile

The datastore features are all contained within the `Autonomy.Connector.Datastore` namespace. The samples in this section assume there is a using directive for this namespace at the beginning of the file:

           using Autonomy.Connector.Datastore;

You can access a datastore for the synchronize action like this:

           public override void Synchronize(ISynchronizeTask task)
           {
               using (DatastoreFile datastore = new DatastoreFile(
    			task.DatastoreFileName, task.Log))
               {
                   // Use datastore ...
               }
           }

This opens or creates the datastore in the file named in `task.DatastoreFileName`. If the datastore already exists the existing datastore is opened (the datastore is not created again). The `DatastoreFile` object provides access to the datastore. This object is disposable, so enclose it in a `using` block.

## Best Practice

OpenText recommends that you use the file named in `ISynchronizeTask.DatastoreFileName` to store all state information for the task. You can use the ``DatastoreFile`` object to store a datastore in that file, or use a format of your choosing.

The advantages of storing all state information in the file specified by `ISynchronizeTask.DatastoreFileName` include:

- ConnectorLib .NET chooses a unique file name that does not conflict with the names used for other tasks. The file name also respects configuration settings regarding the datastore location.
- The same file name is provided to other actions called for the same task (collect, view, insert, update, and so on.)
- The file is backed up and restored automatically if the `backup` and `restore` actions are used.

Copyright 2025 Open Text
Version 25.2 | Last updated April 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery ConnectorLib .NET 25.2

Topic Title: Create a DatastoreFile