.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

XPServerCollectionSource.ObjectType Property

Gets the type of the object that describes the target data table in the data store.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.1.dll


public Type ObjectType { get; set; }

Property Value

Type Description

The Type of the object that describes the target data table.


The XPServerCollectionSource.ObjectType and XPServerCollectionSource.ObjectClassInfo properties provide information that describes the target data table. These properties are synchronized. When initializing the XPServerCollectionSource.ObjectType property, the XPServerCollectionSource.ObjectClassInfo property is initialized with a matching object, and vice versa.

Do not change the XPServerCollectionSource.ObjectType and XPServerCollectionSource.ObjectClassInfo properties directly in your code. Instead, initialize these properties via the objectClassInfo or objectType parameter of the XPServerCollectionSource‘s constructor.

See the XPServerCollectionSource topic for information on how to provide descriptive information on the target data table.


In the example, an XPServerCollectionSource object is created that will provide data from the “Person.Contact” table in a target database.

To link the “Person.Contact” database table with the XPServerCollectionSource object, a persistent object (Person_Contact) describing the data table is declared and its type is passed to the XPServerCollectionSource‘s constructor. The value passed is used to initialize the XPServerCollectionSource.ObjectType property.

The Person_Contact object specifies the name of the target data table via the PersistentAttribute attribute and contains public properties corresponding to the required table’s fields.

using DevExpress.Xpo;
using DevExpress.Xpo.DB;
using DevExpress.Data.Filtering;

public Form1() {
    // ...
    // Create a filter that selects records which contain names starting with 'A' 
    // in the LastName column
    CriteriaOperator criteria = CriteriaOperator.Parse("[LastName] LIKE ?", "A%");
    // Create a data source that provides data from the data table 
    // which is described by the Person_Contact object.
    XPServerCollectionSource serverModeDS = new XPServerCollectionSource( 
      XpoDefault.Session, typeof(Person_Contact), criteria);

// ...

// The persistent object that describes the "Person.Contact" table 
// in the AdventureWorks SQL database.
public class Person_Contact : XPLiteObject {        
    public System.Int32 ContactID {
        get { return fContactID; }
        set { SetPropertyValue(nameof(ContactID), ref fContactID, value); }
    System.Int32 fContactID;

    public string FirstName {
        get { return fFirstName; }
        set { SetPropertyValue(nameof(FirstName), ref fFirstName, value); }
    string fFirstName;

    public string LastName {
        get { return fLastName; }
        set { SetPropertyValue(nameof(LastName), ref fLastName, value); }
    string fLastName;

See Also