Click or drag to resize
PersistentObjectFieldSorterCollection Class
Describes a collection of persistent object field sorters.
Inheritance Hierarchy
SystemObject
  ObujekutoruPersistentObjectFieldSorterCollection

Namespace: Obujekutoru
Assembly: obujekutoru (in obujekutoru.dll) Version: 1.1.0.25794
Syntax
public sealed class PersistentObjectFieldSorterCollection

The PersistentObjectFieldSorterCollection type exposes the following members.

Methods
  NameDescription
Public methodAnd(PersistentObjectFieldSorter)
Adds a persistent object field sorter to an existing collection.
Public methodAnd(String, PersistentObjectFieldSortOperator)
Adds a persistent object field sorter to an existing collection.
Public methodStatic memberEmpty
Builds an empty collection of persistent object field sorters.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
using System;
using System.Collections;
using System.Collections.Generic;

using Obujekutoru;

namespace ObujekutoruExamples.PersistentObjectFieldSorterCollectionExample
{
    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...";

            List<PersistentObject> persistentObjects;

            using (Connection connection = new Connection(dataFolderPath, encryptionType, encryptionKey, true))
            {
                PersistentObjectE persistentObjectE1 = new PersistentObjectE("persistent object E1", 1);
                PersistentObjectE persistentObjectE2 = new PersistentObjectE("persistent object E2", 2);
                PersistentObjectE persistentObjectE3 = new PersistentObjectE("persistent object E3", 3);
                PersistentObjectE persistentObjectE4 = new PersistentObjectE("persistent object E4", 4);
                PersistentObjectE persistentObjectE5 = new PersistentObjectE("persistent object E5", 5);
                PersistentObjectE persistentObjectE6 = new PersistentObjectE("persistent object E6", 6);
                PersistentObjectE persistentObjectE7 = new PersistentObjectE("persistent object E7", 7);
                PersistentObjectE persistentObjectE8 = new PersistentObjectE("persistent object E8", 8);
                PersistentObjectE persistentObjectE9 = new PersistentObjectE("persistent object E9", 9);

                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);

                persistentObjects = connection.SelectPersistentObject(
                    typeof(PersistentObjectE),
                    PersistentObjectFieldFilterCollection.Empty().And(
                        new PersistentObjectFieldFilter(
                            "persistentObjectName",
                            PersistentObjectFieldFilterOperator.GreaterOrEqualThan,
                            "persistent object E4")).And(
                        new PersistentObjectFieldFilter(
                            "persistentObjectValue",
                            PersistentObjectFieldFilterOperator.LessOrEqualThan,
                            6)),
                    PersistentObjectFieldSorterCollection.Empty().And(
                        new PersistentObjectFieldSorter(
                            "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;

        [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