| ConnectionSelectPersistentObjectPersistentObjectType Method |
Retrieves a list of the persistent objects from the data store.
Namespace:
Obujekutoru
Assembly:
obujekutoru (in obujekutoru.dll) Version: 1.2.0.35246
Syntax public List<PersistentObjectType> SelectPersistentObject<PersistentObjectType>(
PersistentObjectFieldFilterCollection persistentObjectFieldFilterCollection,
PersistentObjectFieldSorterCollection persistentObjectFieldSorterCollection,
int start,
int range
)
where PersistentObjectType : class
Public Function SelectPersistentObject(Of PersistentObjectType As Class) (
persistentObjectFieldFilterCollection As PersistentObjectFieldFilterCollection,
persistentObjectFieldSorterCollection As PersistentObjectFieldSorterCollection,
start As Integer,
range As Integer
) As List(Of PersistentObjectType)
public:
generic<typename PersistentObjectType>
where PersistentObjectType : ref class
List<PersistentObjectType>^ SelectPersistentObject(
PersistentObjectFieldFilterCollection^ persistentObjectFieldFilterCollection,
PersistentObjectFieldSorterCollection^ persistentObjectFieldSorterCollection,
int start,
int range
)
member SelectPersistentObject :
persistentObjectFieldFilterCollection : PersistentObjectFieldFilterCollection *
persistentObjectFieldSorterCollection : PersistentObjectFieldSorterCollection *
start : int *
range : int -> List<'PersistentObjectType> when 'PersistentObjectType : not struct
Parameters
- 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.
Type Parameters
- PersistentObjectType
Return Value
Type:
ListPersistentObjectTypeThe list of persistent objects.
Exceptions Examples using System;
using System.Collections;
using System.Collections.Generic;
using Obujekutoru;
namespace ObujekutoruExamples.ConnectionSelectExample
{
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", 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);
connection.InsertPersistentObject(persistentObjectE1);
connection.InsertPersistentObject(persistentObjectE2);
connection.InsertPersistentObject(persistentObjectE3);
connection.InsertPersistentObject(persistentObjectE4);
connection.InsertPersistentObject(persistentObjectE5);
connection.InsertPersistentObject(persistentObjectE6);
connection.InsertPersistentObject(persistentObjectE7);
connection.InsertPersistentObject(persistentObjectE8);
connection.InsertPersistentObject(persistentObjectE9);
List<PersistentObjectE> persistentObjects = connection.SelectPersistentObject<PersistentObjectE>(
PersistentObjectFieldFilterCollection.With(
"persistentObjectValue", PersistentObjectFieldFilterOperator.Equal, 2),
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;
[PersistentObjectField("persistentObjectValue", true)]
private Int32 _persistentObjectValue;
public PersistentObjectE()
{ }
public PersistentObjectE(String persistentObjectName, Int32 persistentObjectValue)
{
_persistentObjectName = persistentObjectName;
_persistentObjectValue = persistentObjectValue;
}
public String PersistentObjectName
{
get { return _persistentObjectName; }
set
{
_persistentObjectName = value;
OnObjectUpdated();
}
}
public Int32 PersistentObjectValue
{
get { return _persistentObjectValue; }
set
{
_persistentObjectValue = value;
OnObjectUpdated();
}
}
}
}
See Also