[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Collapse]eXpress Persistent Objects
 [Expand]Product Information
 [Expand]Getting Started
 [Expand]Fundamentals
 [Expand]Feature Center
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Examples
 [Expand]Member Tables
 [Collapse]API Reference
  [Collapse]DevExpress.Xpo
   [Expand]AggregatedAttribute Class
   [Expand]AssociationAttribute Class
    AsyncCommitCallback Delegate
    AsyncSelectDataCallback Delegate
    CacheBehavior Enumeration
    CollectionBindingBehavior Enumeration
   [Expand]ColumnDbDefaultValueAttribute Class
   [Expand]ColumnDefaultValueAttribute Class
   [Expand]CommitObjectStubsResult Class
   [Expand]CustomAttribute Class
   [Expand]CustomCriteriaManager Class
   [Expand]DataViewPropertiesCollection Class
   [Expand]DataViewProperty Class
   [Expand]DataViewRecord Class
   [Expand]DbTypeAttribute Class
    DefaultMembersPersistence Enumeration
   [Expand]DefaultMembersPersistenceAttribute Class
   [Expand]DeferredDeletionAttribute Class
   [Expand]DelayedAttribute Class
   [Expand]DisplayNameAttribute Class
   [Expand]ExplicitLoadingAttribute Class
   [Expand]ExplicitUnitOfWork Class
   [Expand]FetchOnlyAttribute Class
   [Expand]GetObjectStubsByKeyQuery Class
    GuidGenerationMode Enumeration
   [Expand]HiddenAttribute Class
   [Expand]ICustomCriteriaOperatorQueryable Interface
   [Expand]ICustomFunctionOperatorQueryable Interface
   [Expand]IDataLayer Interface
    IdentityMapBehavior Enumeration
   [Expand]IndexedAttribute Class
   [Expand]IndicesAttribute Class
   [Expand]IObjectLayer Interface
   [Expand]IObjectLayerAsync Interface
   [Expand]IObjectLayerEx Interface
   [Expand]IObjectLayerOnSession Interface
   [Expand]ISerializableObjectLayer Interface
   [Expand]ISerializableObjectLayerEx Interface
   [Expand]IXPModificationsStore Interface
   [Expand]IXPObject Interface
   [Expand]IXPSimpleObject Interface
   [Expand]KeyAttribute Class
   [Expand]LoadDataMemberOrderItem Structure
    LockingOption Enumeration
   [Expand]MapInheritanceAttribute Class
    MapInheritanceType Enumeration
   [Expand]MapToAttribute Class
   [Expand]MemberDesignTimeVisibilityAttribute Class
   [Expand]MergeCollisionBehaviorAttribute Class
   [Expand]NestedUnitOfWork Class
   [Expand]NoForeignKeyAttribute Class
   [Expand]NonPersistentAttribute Class
   [Expand]NullableAttribute Class
    NullableBehavior Enumeration
   [Expand]NullableBehaviorAttribute Class
   [Expand]NullValueAttribute Class
   [Expand]ObjectChangeEventArgs Class
    ObjectChangeEventHandler Delegate
    ObjectChangeReason Enumeration
   [Expand]ObjectManipulationEventArgs Class
    ObjectManipulationEventHandler Delegate
   [Expand]ObjectsByKeyQuery Class
   [Expand]ObjectsManipulationEventArgs Class
    ObjectsManipulationEventHandler Delegate
   [Expand]ObjectsQuery Class
   [Expand]ObjectStubsQuery Class
   [Expand]OptimisticLockingAttribute Class
    OptimisticLockingBehavior Enumeration
   [Expand]OptimisticLockingIgnoredAttribute Class
    OptimisticLockingReadBehavior Enumeration
   [Expand]OptimisticLockingReadBehaviorAttribute Class
    OptimisticLockingReadMergeBehavior Enumeration
   [Expand]PersistentAliasAttribute Class
   [Expand]PersistentAttribute Class
   [Expand]PersistentBase Class
    PersistentCriteriaEvaluationBehavior Enumeration
   [Expand]ResolveSessionEventArgs Class
    ResolveSessionEventHandler Delegate
   [Expand]SchemaInitEventArgs Class
    SchemaInitEventHandler Delegate
   [Expand]SerializableObjectLayer Class
   [Expand]SerializableObjectLayerClient Class
    ServerExceptionThrownAction Enumeration
   [Expand]ServerExceptionThrownEventArgs Class
    ServerExceptionThrownEventHandler Delegate
   [Expand]Session Class
   [Expand]SessionManipulationEventArgs Class
    SessionManipulationEventHandler Delegate
   [Expand]SessionObjectLayer Class
   [Expand]SessionOperationFailEventArgs Class
    SessionOperationFailEventHandler Delegate
   [Expand]SimpleDataLayer Class
   [Expand]SimpleObjectLayer Class
   [Expand]SizeAttribute Class
   [Expand]SkipCheckForFeedsAttribute Class
    SortDirection Enumeration
   [Expand]SortingCollection Class
   [Expand]StreamAttribute Class
   [Expand]ThreadSafeDataLayer Class
   [Expand]UnitOfWork Class
   [Expand]ValueConverterAttribute Class
   [Expand]ViewPropertiesCollection Class
   [Expand]ViewProperty Class
   [Expand]ViewRecord Class
   [Expand]VisibleAttribute Class
   [Expand]XPBaseCollection Class
   [Expand]XPBaseObject Class
   [Expand]XPClassInfoStub Class
   [Expand]XPCollection Class
   [Expand]XPCollection<T> Class
   [Expand]XPCollectionChangedEventArgs Class
    XPCollectionChangedEventHandler Delegate
    XPCollectionChangedType Enumeration
   [Expand]XPCursor Class
   [Expand]XPCustomObject Class
   [Expand]XPDataObject Class
   [Expand]XPDataView Class
   [Expand]XPDelayedProperty Class
   [Expand]XPDictionaryStub Class
   [Expand]XPInstantFeedbackSource Class
   [Expand]XPLiteObject Class
   [Expand]XPObject Class
   [Expand]XPObjectSource Class
   [Expand]XPObjectSourcePropertiesCollection Class
   [Expand]XPObjectSourceProperty Class
   [Expand]XPObjectSourceRecord Class
   [Expand]XPObjectStub Class
   [Expand]XPObjectStubCollection Class
   [Expand]XPObjectType Class
   [Expand]XpoDataSource Class
   [Expand]XpoDataSourceInsertedEventArgs Class
    XpoDataSourceInsertedEventHandler Delegate
   [Expand]XpoDefault Class
   [Expand]XPPageSelector Class
   [Expand]XPQuery<T> Class
   [Expand]XPQueryBase Class
   [Expand]XPQueryExtensions Class
   [Collapse]XPServerCollectionSource Class
     XPServerCollectionSource Members
    [Expand]XPServerCollectionSource Constructor
    [Expand]XPServerCollectionSource Properties
    [Expand]XPServerCollectionSource Events
    [Expand]XPServerCollectionSource Methods
   [Expand]XPView Class
   [Expand]XPWeakReference Class
  [Expand]DevExpress.Xpo.DB
  [Expand]DevExpress.Xpo.DB.Helpers
  [Expand]DevExpress.Xpo.Exceptions
  [Expand]DevExpress.Xpo.Helpers
  [Expand]DevExpress.Xpo.Metadata
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

XPServerCollectionSource Class

The data source for a DevExpress.XtraGrid.GridControl and DevExpress.XtraEditors.GridLookUpEdit controls that binds these controls to data in Server Mode.

Namespace:DevExpress.Xpo
Assembly:DevExpress.Xpo.v18.2.dll

Expanded Syntax

Expanded Remarks

Server mode allows a data-aware control to rapidly work with large datasets. Loading records in small portions on demand, and performing data-aware operations on the data server side are the key features of server mode. Currently, server mode is supported by the DevExpress.XtraGrid.GridControl, DevExpress.XtraEditors.SearchLookUpEdit and DevExpress.XtraEditors.GridLookUpEdit controls.

The XPServerCollectionSource class can be used as a data source for a control in server mode (the control must support the server mode feature). In server mode, a data-aware control needs to be bound to a data source that implements the DevExpress.Data.IListServer interface. The XPServerCollectionSource component implements the System.ComponentModel.IListSource interface, and returns the list implementing the IListServer interface via the IListSource.GetList method.

The XPServerCollectionSource object serves as a conduit of information between the control and a target data store. When the control needs to display a specific portion of data, it calls a certain method of the bound XPServerCollectionSource object. This method sends a corresponding request to the data store, and upon receiving the results, passes them back to the control. If any summary is defined within a control, it's also calculated by the data store.

When creating an XPServerCollectionSource object, you need to provide descriptive information on the target data table (view) in the target data store. First, you need to create a specific object that identifies the data table's name and its structure (the names and types of data fields that need to be obtained). You can do this using one of the following methods:

  1. In code, declare a persistent class (an XPBaseObject descendant) that will correspond to the data table. See the Basics of Creating Persistent Objects for Existing Data Tables topic for further details.
  2. Create a typed System.Data.DataTable object corresponding to the target data table. You can create this DataTable by creating a typed System.Data.DataSet using the VS Designer (see the Data->Add New Data Source... menu command).

After the descriptive object (a persistent object or a typed DataTable) has been created, supply its type to the XPServerCollectionSource object. At design time, you can use the ObjectClassInfo property to assign the descriptive object's type. At runtime, specify the descriptive object's type via the XPServerCollectionSource's constructor using an objectClassInfo or objectType parameter.

Important

In server mode, a target data table must contain a single key field, and the descriptive object must contain a public property/field corresponding to the table's key. If the data table doesn't contain a key field or the key is composed of several columns, it cannot be used as a data source in server mode.

For information on how to enable server mode for a GridControl and GridLookUpEdit controls see the Large Data Sources: Server and Instant Feedback Modes section.

Note

Non-persistent properties can be displayed in the grid, but sorting, grouping, filtering and summaries are not supported for them (also, corresponding grid features are disabled for these properties by default). If non-persistent properties are used for calculated values, it is better to implement them using the PersistentAliasAttribute.

Expanded Example 1

In the following code, an XPServerCollectionSource object is initialized with a persistent object describing a target "Person.Contact" data table (this table is included in the AdventureWorks database that ships with MS SQL Server).

In the code, the Person_Contact persistent object is declared, and mapped to the "Person.Contact" data table using the PersistentAttribute attribute. It exposes specific public properties that match the data table's fields.

To provide data on the Person_Contact object for the XPServerCollectionSource, first a corresponding XPClassInfo object is obtained. Then it's passed to the XPServerCollectionSource's constructor via an objectClassInfo parameter. This initializes the ObjectClassInfo property.

Expanded Example 2

The following code shows how to initialize an XPServerCollectionSource object with a typed System.Data.DataTable object.

It's assumed that a project contains a System.Data.DataSet class (AdventureWorksDataSet) which owns the target DataTable (_Person_ContactDataTable). In the code, first a XPClassInfo object corresponding to the data table is created. Then it's passed to the XPServerCollectionSource object's constructor via the objectClassInfo parameter, initializing the ObjectClassInfo property.

Expanded Inheritance Hierarchy

System.Object
    System.MarshalByRefObject
       System.ComponentModel.Component
          XPServerCollectionSource

Expanded See Also

Is this topic helpful?​​​​​​​