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.v24.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap, DevExpress.Xpo
NuGet Package: DevExpress.Xpo
Declaration
Property Value
Type | Default | Description |
---|---|---|
Type | null | The Type of the object that describes the target data table. |
Remarks
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.
Example
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.
[Persistent("Person.Contact")]
public class Person_Contact : XPLiteObject {
[Key]
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;
//...
}