Click or drag to resize
ConnectionSelectPersistentObjectAsync Method (Type, PersistentObjectFieldFilterCollection, PersistentObjectFieldSorterCollection, Int32, Int32)
Retrieves a list of the persistent objects from the data store as an asynchronous operation.

Namespace: Obujekutoru
Assembly: obujekutoru (in obujekutoru.dll) Version: 1.1.0.25794
Syntax
public Task<List<PersistentObject>> SelectPersistentObjectAsync(
	Type persistentObjectType,
	PersistentObjectFieldFilterCollection persistentObjectFieldFilterCollection,
	PersistentObjectFieldSorterCollection persistentObjectFieldSorterCollection,
	int start,
	int range
)

Parameters

persistentObjectType
Type: SystemType
The persistent object type.
persistentObjectFieldFilterCollection
Type: ObujekutoruPersistentObjectFieldFilterCollection
The persistent object field filters to use for the search.
persistentObjectFieldSorterCollection
Type: ObujekutoruPersistentObjectFieldSorterCollection
The persistent object field sorters to use for the search.
start
Type: SystemInt32
The position of the first persistent object to retrieve (1-based index).
range
Type: SystemInt32
The range of persistent objects to retrieve.

Return Value

Type: TaskListPersistentObject
The task object representing the asynchronous operation.
Exceptions
ExceptionCondition
ArgumentNullException The persistent object type is null, the persistent object field filters list is null, the persistent object field sorters list is null.
ArgumentOutOfRangeException The start has a non-positive value, the range has a non-positive value.
InvalidOperationExceptionThe connection has been disposed of.
Examples
using System;
using System.Collections;
using System.Collections.Generic;

using Obujekutoru;

namespace ObujekutoruExamples.ConnectionSelectExample
{
  ...

    internal class AsyncSelectClass
    {
        public async void AsyncSelectMethod
        {
            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", 1);
                PersistentObjectE persistentObjectE2 = new PersistentObjectE("persistent object E2", 1);
                PersistentObjectE persistentObjectE3 = new PersistentObjectE("persistent object E3", 1);
                PersistentObjectE persistentObjectE4 = new PersistentObjectE("persistent object E4", 2);
                PersistentObjectE persistentObjectE5 = new PersistentObjectE("persistent object E5", 2);
                PersistentObjectE persistentObjectE6 = new PersistentObjectE("persistent object E6", 2);
                PersistentObjectE persistentObjectE7 = new PersistentObjectE("persistent object E7", 3);
                PersistentObjectE persistentObjectE8 = new PersistentObjectE("persistent object E8", 3);
                PersistentObjectE persistentObjectE9 = new PersistentObjectE("persistent object E9", 3);

                await connection.InsertPersistentObjectAsync(persistentObjectE1);
                await connection.InsertPersistentObjectAsync(persistentObjectE2);
                await connection.InsertPersistentObjectAsync(persistentObjectE3);
                await connection.InsertPersistentObjectAsync(persistentObjectE4);
                await connection.InsertPersistentObjectAsync(persistentObjectE5);
                await connection.InsertPersistentObjectAsync(persistentObjectE6);
                await connection.InsertPersistentObjectAsync(persistentObjectE7);
                await connection.InsertPersistentObjectAsync(persistentObjectE8);
                await connection.InsertPersistentObjectAsync(persistentObjectE9);

                List<PersistentObject> persistentObjects = await connection.SelectPersistentObjectAsync(
                    typeof(PersistentObjectE),
                    PersistentObjectFieldFilterCollection.Empty().And(
                        "persistentObjectValue", PersistentObjectFieldFilterOperator.Equal, 2),
                    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