Click or drag to resize

Connection Class

A managed in-process object store connection.
Inheritance Hierarchy
SystemObject
  ObujekutoruConnection

Namespace:  Obujekutoru
Assembly:  obujekutoru (in obujekutoru.dll) Version: 1.2.0.35246
Syntax
public sealed class Connection : IDisposable

The Connection type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleConnection(String, Boolean)
Initializes a new instance of the Connection class.
Public methodCode exampleConnection(String, EncryptionType, String, Boolean)
Initializes a new instance of the Connection class.
Top
Properties
  NameDescription
Public propertyEncryptionKey
The encryption key used for data encryption.
Public propertyEncryptionType
The encryption type used for data encryption.
Public propertyIsDisposed
Gets a value indicating whether the current object is disposed.
Public propertyPersistentObjectDataFolderPath
The persistent object data folder path.
Top
Methods
  NameDescription
Public methodCode exampleDeletePersistentObject
Deletes a persistent object from the data store.
Public methodCode exampleDeletePersistentObjectAsync
Deletes a persistent object from the data store as an asynchronous operation.
Public methodDispose
Releases all resources used by the Connection instance.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the instance.
(Overrides ObjectFinalize.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodCode exampleInsertPersistentObject
Inserts a persistent object in the data store.
Public methodCode exampleInsertPersistentObjectAsync
Inserts a persistent object in the data store as an asynchronous operation.
Public methodCode exampleSelectPersistentObjectPersistentObjectType
Retrieves a list of the persistent objects from the data store.
Public methodCode exampleSelectPersistentObjectAsyncPersistentObjectType
Retrieves a list of the persistent objects from the data store as an asynchronous operation.
Public methodCode exampleSelectPersistentObjectCountPersistentObjectType
Retrieves the count of persistent objects from the data store.
Public methodCode exampleSelectPersistentObjectCountAsyncPersistentObjectType
Retrieves the count of persistent objects from the data store as an asynchronous operation.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodCode exampleUpdatePersistentObject
Updates a persistent object from the data store.
Public methodCode exampleUpdatePersistentObjectAsync
Updates a persistent object from the data store as an asynchronous operation.
Top
Examples
using System;
using System.Collections;
using System.Collections.Generic;

using Obujekutoru;

namespace ObujekutoruExamples.ConnectionExample
{
    class Program
    {
        static void Main(string[] args)
        {
            String dataFolderPath = @"C:\Temp\ObujekutoruData";
            EncryptionType encryptionType = EncryptionType.DESEncryption;
            String encryptionKey = "A proavo habui, quod publicos litterarum ludos non frequentavi, et domi bonis praeceptoribus usus...";

            using (Connection connection = new Connection(dataFolderPath, encryptionType, encryptionKey, true))
            {
                PersistentObjectE persistentObjectE1 = new PersistentObjectE("persistent object E1");
                PersistentObjectE persistentObjectE2 = new PersistentObjectE("persistent object E2");
                PersistentObjectE persistentObjectE3 = new PersistentObjectE("persistent object E3");

                connection.InsertPersistentObject(persistentObjectE1);
                connection.InsertPersistentObject(persistentObjectE2);
                connection.InsertPersistentObject(persistentObjectE3);

                List<PersistentObjectE> persistentObjects = connection.SelectPersistentObject<PersistentObjectE>(
                    PersistentObjectFieldFilterCollection.Empty(),
                    PersistentObjectFieldSorterCollection.With(
                        "persistentObjectName", PersistentObjectFieldSortOperator.Ascending),
                    1, Int32.MaxValue);

                Console.WriteLine("persistentObjects[0] = {0}", persistentObjects[0].PersistentObjectName);
                Console.WriteLine("persistentObjects[1] = {0}", persistentObjects[1].PersistentObjectName);
                Console.WriteLine("persistentObjects[2] = {0}", persistentObjects[2].PersistentObjectName);
            }
        }
    }

    [PersistentObject("PersistentObjectE")]
    internal class PersistentObjectE : PersistentObject
    {
        [PersistentObjectField("persistentObjectName", true)]
        private String _persistentObjectName;

        public PersistentObjectE()
        { }
        public PersistentObjectE(String persistentObjectName)
        {
            _persistentObjectName = persistentObjectName;
        }

        public String PersistentObjectName
        {
            get { return _persistentObjectName; }
            set
            {
                _persistentObjectName = value;

                OnObjectUpdated();
            }
        }
    }
}
See Also