Table of Contents

Class XPBaseCollection

Namespace
DevExpress.Xpo
Assembly
DevExpress.Xpo.v24.1.dll

An ancestor of the XPCollection class.

public abstract class XPBaseCollection : Component, IComponent, IDisposable, IBindingList, ITypedList, ISupportInitialize, IXPClassInfoAndSessionProvider, IXPClassInfoProvider, ISessionProvider, IObjectLayerProvider, IDataLayerProvider, IXPDictionaryProvider, IObjectChange, IFilteredXtraBindingList, IFilteredDataSource, IXPPrefetchableAssociationList, IXPBulkLoadableCollection, IList, ICollection, IEnumerable
Inheritance
XPBaseCollection
Implements
IFilteredXtraBindingList
IFilteredDataSource
Derived
Inherited Members

Constructors

XPBaseCollection()

protected XPBaseCollection()

XPBaseCollection(XPCollectionHelper)

protected XPBaseCollection(XPCollectionHelper helper)

Parameters

helper XPCollectionHelper

XPBaseCollection(PersistentCriteriaEvaluationBehavior, Session, XPClassInfo, CriteriaOperator, bool)

protected XPBaseCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, XPClassInfo objType, CriteriaOperator condition, bool selectDeleted)

Parameters

criteriaEvaluationBehavior PersistentCriteriaEvaluationBehavior
session Session
objType XPClassInfo
condition CriteriaOperator
selectDeleted bool

XPBaseCollection(Session, XPClassInfo, CriteriaOperator, params SortProperty[])

protected XPBaseCollection(Session session, XPClassInfo objType, CriteriaOperator theCriteria, params SortProperty[] sortProperties)

Parameters

session Session
objType XPClassInfo
theCriteria CriteriaOperator
sortProperties SortProperty[]

XPBaseCollection(Session, XPClassInfo, Session, IEnumerable, CriteriaOperator, bool)

protected XPBaseCollection(Session session, XPClassInfo objType, Session originalSession, IEnumerable originalCollection, CriteriaOperator copyFilter, bool caseSensitive)

Parameters

session Session
objType XPClassInfo
originalSession Session
originalCollection IEnumerable
copyFilter CriteriaOperator
caseSensitive bool

XPBaseCollection(Session, XPClassInfo, bool)

protected XPBaseCollection(Session session, XPClassInfo objType, bool loadingEnabled)

Parameters

session Session
objType XPClassInfo
loadingEnabled bool

XPBaseCollection(Session, object, XPMemberInfo)

protected XPBaseCollection(Session session, object theOwner, XPMemberInfo refProperty)

Parameters

session Session
theOwner object
refProperty XPMemberInfo

XPBaseCollection(bool)

protected XPBaseCollection(bool loadingEnabled)

Parameters

loadingEnabled bool

Fields

Helper

protected readonly XPCollectionHelper Helper

Field Value

XPCollectionHelper

Initializing

protected bool Initializing

Field Value

bool

Properties

BindingBehavior

Defines which operations a bound control can perform on a collection.

This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.

public CollectionBindingBehavior BindingBehavior { get; set; }

Property Value

CollectionBindingBehavior

The CollectionBindingBehavior which specifies which operations a bound control can perform on a collection.

CanFireChangedEvents

protected bool CanFireChangedEvents { get; }

Property Value

bool

CaseSensitive

Gets or sets whether string comparisons during sorting and filtering of the XPBaseCollection are case-sensitive.

public bool CaseSensitive { get; set; }

Property Value

bool

true if string comparisons are case-sensitive; otherwise, false.

ClearCount

For internal use.

[Browsable(false)]
public long ClearCount { get; }

Property Value

long

Count

Gets the number of elements contained in the XPBaseCollection instance.

[Browsable(false)]
public int Count { get; }

Property Value

int

The number of elements contained in the collection

Criteria

Gets or sets the criteria used to filter objects on the data store side.

[TypeConverter("DevExpress.Xpo.Design.CriteriaConverter, DevExpress.Xpo.v24.1.Design, Version=24.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a")]
public CriteriaOperator Criteria { get; set; }

Property Value

CriteriaOperator

A DevExpress.Data.Filtering.CriteriaOperator object that specifies the criteria to filter objects on the data store side.

CriteriaString

Gets or sets the criteria used to filter objects on the data store side.

[Browsable(false)]
public string CriteriaString { get; set; }

Property Value

string

A string value that specifies the criteria to filter objects on the data store side.

DeleteObjectOnRemove

Gets or sets whether the persistent object is deleted from the data store when it is removed from the collection.

public bool DeleteObjectOnRemove { get; set; }

Property Value

bool

true if the persistent object is deleted from the data store when it is removed from the collection; otherwise, false.

DisplayableProperties

Gets or sets the displayable properties list for a bound control.

public string DisplayableProperties { get; set; }

Property Value

string

The displayable properties list, containing property paths separated by semicolons. For example, “FirstName;LastName;Company.Name;Address.City”.

EnableObjectChangedNotificationsWhileEditing

Specifies whether object changed notifications occur when editing a property.

[Obsolete("That property breaks XPCollection's compatibility with DataSet. Use it at your own risk.")]
public static bool EnableObjectChangedNotificationsWhileEditing { get; set; }

Property Value

bool

true if object changed notifications occur when editing a property; otherwise, false.

Filter

Gets or sets the criteria used to filter objects on the client side.

[Browsable(false)]
public CriteriaOperator Filter { get; set; }

Property Value

CriteriaOperator

A DevExpress.Data.Filtering.CriteriaOperator object that specifies the criteria to filter objects on the client side.

HintCollection

This member supports the .NET Framework infrastructure and cannot be used directly from your code.

[Browsable(false)]
public IEnumerable HintCollection { get; set; }

Property Value

IEnumerable

An object that implements the IEnumerable interface.

IsAsyncLoading

For internal use.

[Browsable(false)]
public bool IsAsyncLoading { get; }

Property Value

bool

IsDesignMode

protected bool IsDesignMode { get; }

Property Value

bool

IsDesignMode2

protected bool IsDesignMode2 { get; }

Property Value

bool

IsLoaded

Gets whether the XPBaseCollection collection is loaded with objects from the data store.

[Browsable(false)]
public bool IsLoaded { get; }

Property Value

bool

true if the collection is loaded with objects from the data store; otherwise, false.

LoadingEnabled

Gets or sets whether loading of data from a data store to the collection is enabled.

public bool LoadingEnabled { get; set; }

Property Value

bool

true if data can be loaded; otherwise, false.

Objects

protected IList Objects { get; }

Property Value

IList

SelectDeleted

Gets or sets whether objects that are marked as deleted are retrieved by a collection from a data store.

public bool SelectDeleted { get; set; }

Property Value

bool

true if objects marked as deleted are loaded to the collection from a data store; otherwise, false.

Session

Gets or sets the Session used by the current collection.

[TypeConverter("DevExpress.Xpo.Design.SessionReferenceConverter, DevExpress.Xpo.v24.1.Design, Version=24.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a")]
public Session Session { get; set; }

Property Value

Session

The session with a connection to a data source. The default value is Session.DefaultSession.

SkipReturnedObjects

Gets or sets the number of objects to exclude when populating the collection with objects from a data store.

public int SkipReturnedObjects { get; set; }

Property Value

int

An integer value that specifies the number of objects to exclude when populating the collection. 0 indicates that objects are not excluded.

Sorting

Gets or sets the sort settings for the current collection.

public SortingCollection Sorting { get; set; }

Property Value

SortingCollection

The SortingCollection that specifies the sort order for the collection.

TopReturnedObjects

Gets or sets the maximum number of objects retrieved by the collection from a data store.

public int TopReturnedObjects { get; set; }

Property Value

int

An integer that specifies the maximum number of objects that will be retrieved by the collection from a data store. 0 indicates that all objects which match the criteria will be retrieved.

Methods

BaseAdd(object)

Adds the specified persistent object to the XPBaseCollection.

public virtual int BaseAdd(object newObject)

Parameters

newObject object

The persistent object to add to the collection.

Returns

int

The zero-based index position at which the new element was inserted.

BaseAddRange(ICollection)

Adds each element from a specified collection of persistent objects to the XPBaseCollection.

public void BaseAddRange(ICollection objects)

Parameters

objects ICollection

An ICollection object, which is a collection of persistent objects to add to the XPBaseCollection.

BaseIndexOf(object)

Determines the index of the specified object in the XPBaseCollection.

public virtual int BaseIndexOf(object value)

Parameters

value object

The persistent object to locate in the XPBaseCollection.

Returns

int

The zero-based index of the object in the XPBaseCollection, if found; otherwise, -1.

BaseIndexer(int)

Gets the object at the specified index.

public virtual object BaseIndexer(int index)

Parameters

index int

The zero-based index of the object to get.

Returns

object

The object at the specified index in the XPBaseCollection.

BaseRemove(object)

Removes the specified persistent object from the XPBaseCollection.

public virtual bool BaseRemove(object theObject)

Parameters

theObject object

An object to remove from the collection.

Returns

bool

true if the object has been successfully removed from the collection; otherwise, false.

BaseRemoveAsync(object, CancellationToken)

Asynchronously removes the specified persistent object from the XPBaseCollection.

public Task<bool> BaseRemoveAsync(object theObject, CancellationToken cancellationToken = default)

Parameters

theObject object

An object to remove from the collection.

cancellationToken CancellationToken

A CancellationToken object that delivers a cancellation notice to the running operation.

Returns

Task<bool>

A Task<TResult> that returns true if the object has been successfully removed from the collection; otherwise, false.

BeginLoad()

Starts the loading process.

public ObjectsQuery BeginLoad()

Returns

ObjectsQuery

BeginLoad(bool)

Starts the loading process.

public ObjectsQuery BeginLoad(bool force)

Parameters

force bool

Returns

ObjectsQuery

BeginLoadAsync(bool, CancellationToken)

public Task<ObjectsQuery> BeginLoadAsync(bool force, CancellationToken cancellationToken = default)

Parameters

force bool
cancellationToken CancellationToken

Returns

Task<ObjectsQuery>

BeginLoadAsync(CancellationToken)

public Task<ObjectsQuery> BeginLoadAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<ObjectsQuery>

Clear()

protected void Clear()

CreateAddNewInstance()

protected virtual object CreateAddNewInstance()

Returns

object

Dispose(bool)

protected override void Dispose(bool disposing)

Parameters

disposing bool

EndLoad(IEnumerable)

Ends the loading process.

public void EndLoad(IEnumerable objects)

Parameters

objects IEnumerable

EvaluateDatastoreCount()

Specifies the number of elements that will be contained in the collection after loading it.

public int EvaluateDatastoreCount()

Returns

int

An integer value specifying the number of elements that will be contained in the collection after loading it.

GetDefaultDisplayableProperties(XPClassInfo)

Returns the default value for the XPBaseCollection.DisplayableProperties property for the specified object type.

public static StringCollection GetDefaultDisplayableProperties(XPClassInfo objectInfo)

Parameters

objectInfo XPClassInfo

An XPClassInfo object whose properties should be returned.

Returns

StringCollection

The default value for the XPBaseCollection.DisplayableProperties property.

GetObjectClassInfo()

When implemented by a class, returns the metadata information that describes the type of objects in the collection.

public abstract XPClassInfo GetObjectClassInfo()

Returns

XPClassInfo

An XPClassInfo object that specifies the type of objects in the collection.

GoMuteIfNeeded()

protected virtual void GoMuteIfNeeded()

InvokeListChanged(ListChangedType, int)

[Obsolete("Use InvokeListChanged(ListChangedType changeType, string propertyName, int newIndex) instead.")]
protected virtual void InvokeListChanged(ListChangedType changeType, int newIndex)

Parameters

changeType ListChangedType
newIndex int

InvokeListChanged(ListChangedType, string, int)

protected virtual void InvokeListChanged(ListChangedType changeType, string propertyName, int newIndex)

Parameters

changeType ListChangedType
propertyName string
newIndex int

Load()

Loads persistent objects of a specific type from the data store into the collection.

public virtual void Load()

LoadAsync()

Asynchronously loads persistent objects of a specific type from the data store into the collection.

public virtual bool LoadAsync()

Returns

bool

true if the current method call started collection loading; otherwise, false.

LoadAsync(AsyncLoadObjectsCallback)

Asynchronously loads persistent objects of a specific type from the data store into the collection, and notifies upon completion.

public virtual bool LoadAsync(AsyncLoadObjectsCallback callback)

Parameters

callback AsyncLoadObjectsCallback

A DevExpress.Xpo.Helpers.AsyncLoadObjectsCallback delegate to be called after loading is complete.Use callback to do the following:Do not raise exceptions or modify persistent objects within a callback.

Returns

bool

true if the current method call started the collection load; otherwise, false.

LoadAsync(CancellationToken)

Asynchronously loads persistent objects of a specific type from the data store into the collection.

public virtual Task LoadAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A CancellationToken object that delivers a cancellation notice to the running operation.

Returns

Task

A Task that starts the collection load.

OnCollectionChanged(XPCollectionChangedEventArgs)

protected virtual void OnCollectionChanged(XPCollectionChangedEventArgs args)

Parameters

args XPCollectionChangedEventArgs

OnResolveSession(ResolveSessionEventArgs)

protected virtual void OnResolveSession(ResolveSessionEventArgs args)

Parameters

args ResolveSessionEventArgs

PreFetch(params string[])

Enforces loading data for associated collections and delayed properties.

public void PreFetch(params string[] propertyPaths)

Parameters

propertyPaths string[]

An array of strings that are the collection property and delayed property names, or property paths (e.g, “ChildCollection.AnotherChildCollection”).

Reload()

Clears the collection and marks it to be reloaded with data from the data store.

public virtual void Reload()

RenewObjectClassInfoOnSessionChange()

protected virtual void RenewObjectClassInfoOnSessionChange()

ResumeChangedEvents()

Resumes the immediate update of the collection after it was suspended using the XPBaseCollection.SuspendChangedEvents method.

public void ResumeChangedEvents()

SuspendChangedEvents()

Prevents the immediate update of the collection when objects are added/removed and filtering/sorting is changed until the XPBaseCollection.ResumeChangedEvents method is called.

public void SuspendChangedEvents()

ToString()

Returns a string that represents the current XPCollection.

public override string ToString()

Returns

string

A string value which represents the current object.

Events

CollectionChanged

Occurs when an item is added to, or removed from the XPBaseCollection (when the XPBaseCollection.BaseAdd or XPBaseCollection.BaseRemove method is called).

public event XPCollectionChangedEventHandler CollectionChanged

Event Type

XPCollectionChangedEventHandler

ListChanged

Occurs when the list or an item in the list of the XPBaseCollection collection is changed.

public event ListChangedEventHandler ListChanged

Event Type

ListChangedEventHandler

ResolveSession

Enables the collection to be associated with a session.

public event ResolveSessionEventHandler ResolveSession

Event Type

ResolveSessionEventHandler