Class XPCollection
- Namespace
- DevExpress.Xpo
- Assembly
- DevExpress.Xpo.v24.1.dll
The collection of persistent objects that implements delayed loading and can serve as a data source for a data-aware control.
public class XPCollection : XPBaseCollection, IComponent, IDisposable, IBindingList, ITypedList, ISupportInitialize, IXPClassInfoAndSessionProvider, IXPClassInfoProvider, ISessionProvider, IObjectLayerProvider, IDataLayerProvider, IXPDictionaryProvider, IObjectChange, IFilteredXtraBindingList, IFilteredDataSource, IXPPrefetchableAssociationList, IXPBulkLoadableCollection, IList, ICollection, IEnumerable
- Inheritance
-
XPCollection
- Implements
-
IFilteredXtraBindingListIFilteredDataSource
- Inherited Members
Constructors
XPCollection()
Initializes a new instance of the XPCollection class with the default Session.
public XPCollection()
XPCollection(XPCollectionHelper)
protected XPCollection(XPCollectionHelper helper)
Parameters
helper
XPCollectionHelper
XPCollection(PersistentCriteriaEvaluationBehavior, Session, XPClassInfo, CriteriaOperator)
Initializes a new instance of the XPCollection class with specified settings.
public XPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, XPClassInfo objType, CriteriaOperator condition)
Parameters
criteriaEvaluationBehavior
PersistentCriteriaEvaluationBehaviorA PersistentCriteriaEvaluationBehavior enumeration value that specifies how the persistent criteria are evaluated.
session
SessionThe Session that will be used to load and save persistent objects.
objType
XPClassInfoThe persistent class metadata information of objects to include into the collection.
condition
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.
XPCollection(PersistentCriteriaEvaluationBehavior, Session, XPClassInfo, CriteriaOperator, bool)
Initializes a new instance of the XPCollection class with specified settings.
public XPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, XPClassInfo objType, CriteriaOperator condition, bool selectDeleted)
Parameters
criteriaEvaluationBehavior
PersistentCriteriaEvaluationBehaviorA PersistentCriteriaEvaluationBehavior enumeration value that specifies how the persistent criteria are evaluated.
session
SessionThe Session that will be used to load and save persistent objects.
objType
XPClassInfoThe persistent class’s metadata information of objects to include into the collection.
condition
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.
selectDeleted
booltrue if objects marked as deleted are loaded to the collection from a data store; otherwise, false.
XPCollection(PersistentCriteriaEvaluationBehavior, Session, Type, CriteriaOperator)
Initializes a new instance of the XPCollection class with specified settings.
public XPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, Type objType, CriteriaOperator condition)
Parameters
criteriaEvaluationBehavior
PersistentCriteriaEvaluationBehaviorA PersistentCriteriaEvaluationBehavior enumeration value that specifies how the persistent criteria are evaluated.
session
SessionThe Session that will be used to load and save persistent objects.
objType
TypeThe type of persistent objects to include into the collection.
condition
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.
XPCollection(Session, XPClassInfo)
Initializes a new instance of the XPCollection class with specified settings.
public XPCollection(Session session, XPClassInfo objType)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
objType
XPClassInfoThe persistent class’s metadata information of objects to include into the collection.
XPCollection(Session, XPClassInfo, CriteriaOperator, params SortProperty[])
Initializes a new instance of the XPCollection class with a specified Session and criteria-specific options.
public XPCollection(Session session, XPClassInfo objType, CriteriaOperator theCriteria, params SortProperty[] sortProperties)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
objType
XPClassInfoThe persistent class’s metadata information of objects to include into the collection.
theCriteria
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.
sortProperties
SortProperty[]An array of the DevExpress.Xpo.SortProperty that specify the sort order for the collection.
XPCollection(Session, XPClassInfo, bool)
Initializes a new instance of the XPCollection class with specified settings.
public XPCollection(Session session, XPClassInfo objType, bool loadingEnabled)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
objType
XPClassInfoThe persistent class’s metadata information of objects to include into the collection.
loadingEnabled
boolA Boolean value that specifies whether the collection is automatically populated with objects from the data store when the collection’s content is accessed for the first time (for instance, when the XPBaseCollection.Count property is read). This parameter is used to initialize the XPBaseCollection.LoadingEnabled property.
XPCollection(Session, XPClassInfo, IEnumerable)
Initializes a new instance of the XPCollection class by copying objects from a specific collection using specified settings.
public XPCollection(Session session, XPClassInfo objType, IEnumerable originalCollection)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
objType
XPClassInfoThe persistent class’s metadata information of objects to include into the collection.
originalCollection
IEnumerableAn object that implements the IEnumerable interface.
XPCollection(Session, XPClassInfo, IEnumerable, CriteriaOperator)
Initializes a new instance of the XPCollection class by copying objects from a specific collection using specified settings.
public XPCollection(Session session, XPClassInfo objType, IEnumerable originalCollection, CriteriaOperator copyFilter)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
objType
XPClassInfoThe persistent class’s metadata information of objects to include into the collection.
originalCollection
IEnumerableAn object that implements the IEnumerable interface.
copyFilter
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.
XPCollection(Session, XPClassInfo, IEnumerable, CriteriaOperator, bool)
Initializes a new instance of the XPCollection class by copying objects from a specific collection using specified settings.
public XPCollection(Session session, XPClassInfo objType, IEnumerable originalCollection, CriteriaOperator copyFilter, bool caseSensitive)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
objType
XPClassInfoThe persistent class’s metadata information of objects to include into the collection.
originalCollection
IEnumerableAn object that implements the IEnumerable interface.
copyFilter
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.
caseSensitive
booltrue if string comparison operators specified by the copyFilter are case-sensitive; otherwise, false. This value is assigned to the XPBaseCollection.CaseSensitive property.
XPCollection(Session, XPBaseCollection)
Initializes a new instance of the XPCollection class by copying objects from a specific collection using specified settings.
public XPCollection(Session session, XPBaseCollection originalCollection)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
originalCollection
XPBaseCollectionAn XPBaseCollection from which objects are copied to the newly created collection.
XPCollection(Session, XPBaseCollection, CriteriaOperator)
Initializes a new instance of the XPCollection class by copying objects from a specific collection using specified settings.
public XPCollection(Session session, XPBaseCollection originalCollection, CriteriaOperator copyFilter)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
originalCollection
XPBaseCollectionAn XPBaseCollection from which objects are copied to the newly created collection.
copyFilter
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.
XPCollection(Session, XPBaseCollection, CriteriaOperator, bool)
Initializes a new instance of the XPCollection class by copying objects from a specific collection using specified settings.
public XPCollection(Session session, XPBaseCollection originalCollection, CriteriaOperator copyFilter, bool caseSensitive)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
originalCollection
XPBaseCollectionAn XPBaseCollection from which objects are copied to the newly created collection.
copyFilter
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.
caseSensitive
booltrue if string comparison operators specified by the copyFilter are case-sensitive; otherwise, false. This value is assigned to the XPBaseCollection.CaseSensitive property.
XPCollection(Session, object, XPMemberInfo)
Initializes a new instance of the XPCollection class with specified settings.
public XPCollection(Session session, object theOwner, XPMemberInfo refProperty)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
theOwner
objectThe object that will own the new collection.
refProperty
XPMemberInfoThe owner’s property for which the related object collection is created.
XPCollection(Session, Type)
Initializes a new instance of the XPCollection class with specified settings.
public XPCollection(Session session, Type objType)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
objType
TypeThe type of persistent objects to include into the collection.
XPCollection(Session, Type, CriteriaOperator, params SortProperty[])
Initializes a new instance of the XPCollection class with a specified Session and criteria-specific options.
public XPCollection(Session session, Type objType, CriteriaOperator theCriteria, params SortProperty[] sortProperties)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
objType
TypeThe type of persistent objects to include into the collection.
theCriteria
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.
sortProperties
SortProperty[]An array of DevExpress.Xpo.SortProperty that specifies the sort order for the collection.
XPCollection(Session, Type, bool)
Initializes a new instance of the XPCollection class with specified settings.
public XPCollection(Session session, Type objType, bool loadingEnabled)
Parameters
session
SessionThe Session that will be used to load and save persistent objects.
objType
TypeThe type of persistent objects to include into the collection.
loadingEnabled
boolA Boolean value that specifies whether the collection is automatically populated with objects from the data store when the collection is accessed for the first time (for instance, when the XPBaseCollection.Count property is read). This parameter is used to initialize the XPBaseCollection.LoadingEnabled property.
XPCollection(XPBaseCollection)
Initializes a new instance of the XPCollection class by copying objects from a specified collection.
public XPCollection(XPBaseCollection originalCollection)
Parameters
originalCollection
XPBaseCollectionAn XPBaseCollection from which objects are copied to the newly created collection.
XPCollection(XPBaseCollection, CriteriaOperator)
Initializes a new instance of the XPCollection class by copying objects from a specific collection using specified settings.
public XPCollection(XPBaseCollection originalCollection, CriteriaOperator filter)
Parameters
originalCollection
XPBaseCollectionAn XPBaseCollection from which objects are copied to the newly created collection.
filter
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.
XPCollection(XPBaseCollection, CriteriaOperator, bool)
Initializes a new instance of the XPCollection class by copying objects from a specific collection using specified settings.
public XPCollection(XPBaseCollection originalCollection, CriteriaOperator filter, bool caseSensitive)
Parameters
originalCollection
XPBaseCollectionAn XPBaseCollection from which objects are copied to the newly created collection.
filter
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.
caseSensitive
booltrue if string comparison operators specified by the filter are case-sensitive; otherwise, false. This value is assigned to the XPBaseCollection.CaseSensitive property.
XPCollection(IContainer)
Initializes a new instance of the XPCollection class and adds it to a form’s container.
public XPCollection(IContainer container)
Parameters
container
IContainerAn IContainer object, which is the owner container of the created XPCollection instance.
XPCollection(Type)
Initializes a new instance of the XPCollection class with the default Session and object type.
public XPCollection(Type objType)
Parameters
objType
TypeThe type of persistent objects to include into the collection.
XPCollection(Type, CriteriaOperator, params SortProperty[])
Initializes a new instance of the XPCollection class with default Session and criteria-specific options.
public XPCollection(Type objType, CriteriaOperator theCriteria, params SortProperty[] sortProperties)
Parameters
objType
TypeThe type of persistent objects to include into the collection.
theCriteria
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.
sortProperties
SortProperty[]An array of DevExpress.Xpo.SortProperty that specifies the sort order for the collection.
Properties
this[int]
Gets the object at the specified index.
[Browsable(false)]
public object this[int index] { get; }
Parameters
index
intThe zero-based index of the object to get.
Property Value
- object
An object at the specified index in XPCollection.
ObjectClassInfo
Gets or sets the metadata information that describes the type of objects stored in the current collection.
[TypeConverter("DevExpress.Xpo.Design.ObjectClassInfoTypeConverter, DevExpress.Xpo.v24.1.Design, Version=24.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a")]
public XPClassInfo ObjectClassInfo { get; set; }
Property Value
- XPClassInfo
The XPClassInfo of the persistent object stored in the collection.
ObjectType
This member supports the XPO Framework infrastructure and is not intended to be used directly from your code.
[Browsable(false)]
public Type ObjectType { get; set; }
Property Value
Methods
Add(object)
Adds the specified persistent object to the XPCollection.
public int Add(object newObject)
Parameters
newObject
objectThe persistent object to add to the collection.
Returns
- int
The zero-based index position at which the new element is inserted.
AddRange(ICollection)
Adds each element from a specified collection of persistent objects to the XPCollection.
public void AddRange(ICollection objects)
Parameters
objects
ICollectionAn ICollection object, which is a collection of persistent objects to add to the XPCollection.
GetObjectClassInfo()
Gets the metadata information for the persistent objects contained in the collection.
public override XPClassInfo GetObjectClassInfo()
Returns
- XPClassInfo
An XPClassInfo object that specifies the metadata information for the persistent objects in the collection.
IndexOf(object)
Returns the index of the specified object in the XPCollection.
public int IndexOf(object theObject)
Parameters
theObject
objectThe persistent object to locate in the collection.
Returns
- int
The zero-based index of the object in the XPCollection, if found; otherwise, -1.
Lookup(object)
Retrieves an object from the collection by object ID.
public object Lookup(object key)
Parameters
key
objectID of an object to retrieve from the collection.
Returns
- object
An object found or null reference (Nothing in VisualBasic) if an object does not exist in the collection.
Remove(object)
Removes the specified object from the XPCollection.
public void Remove(object theObject)
Parameters
theObject
objectAn object to remove from the collection.
RenewObjectClassInfoOnSessionChange()
protected override void RenewObjectClassInfoOnSessionChange()