Connection Class |
Namespace: Obujekutoru
The Connection type exposes the following members.
Name | Description | |
---|---|---|
Connection(String, Boolean) |
Initializes a new instance of the Connection class.
| |
Connection(String, EncryptionType, String, Boolean) |
Initializes a new instance of the Connection class.
|
Name | Description | |
---|---|---|
EncryptionKey |
The encryption key used for data encryption.
| |
EncryptionType |
The encryption type used for data encryption.
| |
IsDisposed |
Gets a value indicating whether the current object is disposed.
| |
PersistentObjectDataFolderPath |
The persistent object data folder path.
|
Name | Description | |
---|---|---|
DeletePersistentObject |
Deletes a persistent object from the data store.
| |
Dispose |
Releases all resources used by the Connection instance.
| |
Equals | (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
InsertPersistentObject |
Inserts a persistent object in the data store.
| |
SelectPersistentObject |
Retrieves a list of the persistent objects from the data store.
| |
SelectPersistentObjectCount |
Retrieves the count of persistent objects from the data store.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
UpdatePersistentObject |
Updates a persistent object from the data store.
|
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<PersistentObject> persistentObjects = connection.SelectPersistentObject( typeof(PersistentObjectE), PersistentObjectFieldFilterCollection.Empty(), PersistentObjectFieldSorterCollection.Empty().And( "persistentObjectName", PersistentObjectFieldSortOperator.Ascending), 1, Int32.MaxValue); Console.WriteLine("persistentObjects[0] = {0}", (persistentObjects[0] as PersistentObjectE).PersistentObjectName); Console.WriteLine("persistentObjects[1] = {0}", (persistentObjects[1] as PersistentObjectE).PersistentObjectName); Console.WriteLine("persistentObjects[2] = {0}", (persistentObjects[2] as PersistentObjectE).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; _isDirty = true; _updated = DateTime.UtcNow; } } } }