XPDataView.PopulatePropertiesOrdered(XPClassInfo, LoadDataMemberOrderItem[]) Method
Populates the data view with columns based on the specified metadata and mapping information.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
classInfo | XPClassInfo | An XPClassInfo object containing metadata information on the object whose persistent properties are used to populate the XPDataView.Properties collection. |
members | LoadDataMemberOrderItem[] | An array of LoadDataMemberOrderItem objects which provide mapping information. |
Remarks
This method performs the following:
- Clears the XPDataView.Properties collection.
- Populates this collection with columns based on the persistent properties of an object whose metadata is passed as the classInfo parameter. The property names are specified via LoadDataMemberOrderItem.ClassMemberName property values of objects passed as the members parameter.
Use PopulatePropertiesOrdered in conjunction with the XPDataView.LoadOrderedData method, which requires column mapping information to load data into the data view. If you do not provide column mapping information for the data view, use the XPDataView.PopulateProperties method, to populate it with columns.
Example
The following code snippet demonstrates how to use column mapping information to populate the XPDataView with columns, and load data.
// The result set retrieves four columns.
DevExpress.Xpo.DB.SelectedData resultSet =
session1.ExecuteQuery("SELECT Oid, Age, Name, BigPicture FROM [Person]");
// The data view will display only two of them - Name and Age.
// We map these columns to corresponding result set columns,
// using their indexes in the result set.
LoadDataMemberOrderItem[] personsLoadOrder = new LoadDataMemberOrderItem[] {
new LoadDataMemberOrderItem(2, "Name"),
new LoadDataMemberOrderItem(1, "Age")
};
// The data view is populated with columns and loads its data
// using the specified mapping information.
xpDataView1.PopulatePropertiesOrdered(session1.GetClassInfo<Person>(), personsLoadOrder);
xpDataView1.LoadOrderedData(personsLoadOrder, resultSet);