| ConnectionInsertPersistentObjectAsync Method |
Inserts a persistent object in the data store as an asynchronous operation.
Namespace: ObujekutoruAssembly: obujekutoru (in obujekutoru.dll) Version: 1.1.0.25794
Syntax public Task InsertPersistentObjectAsync(
PersistentObject persistentObject
)
Public Function InsertPersistentObjectAsync (
persistentObject As PersistentObject
) As Task
public:
Task^ InsertPersistentObjectAsync(
PersistentObject^ persistentObject
)
member InsertPersistentObjectAsync :
persistentObject : PersistentObject -> Task
Parameters
- persistentObject
- Type: ObujekutoruPersistentObject
The persistent object to be inserted.
Return Value
Type:
TaskThe task object representing the asynchronous operation.
Exceptions Examples using System;
using System.Collections;
using System.Collections.Generic;
using Obujekutoru;
namespace ObujekutoruExamples.ConnectionInsertExample
{
...
internal class AsyncInsertClass
{
public async void InsertAsyncMethod()
{
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");
await connection.InsertPersistentObjectAsync(persistentObjectE1);
await connection.InsertPersistentObjectAsync(persistentObjectE2);
await connection.InsertPersistentObjectAsync(persistentObjectE3);
List<PersistentObject> persistentObjects = await connection.SelectPersistentObjectAsync(
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);
}
}
}
...
}
See Also