.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
The page you are viewing does not exist in the .NET Core 3.0+ platform documentation. This link will take you to the parent topic of the current section.

XPClassInfo.CreateMember(String, XPClassInfo, Attribute[]) Method

Creates a new member metadata which is referenced to the specified XPClassInfo object.

Namespace: DevExpress.Xpo.Metadata

Assembly: DevExpress.Xpo.v20.1.dll


public XPCustomMemberInfo CreateMember(
    string propertyName,
    XPClassInfo referenceType,
    params Attribute[] attributes
Public Function CreateMember(
    propertyName As String,
    referenceType As XPClassInfo,
    ParamArray attributes As Attribute()
) As XPCustomMemberInfo


Name Type Description
propertyName String

A String value which specifies the name of the new member.

referenceType XPClassInfo

An XPClassInfo object which provides the metadata of the class that the new property references.

attributes Attribute[]

An array of Attribute objects that represent the new member's attributes.


Type Description

An XPCustomMemberInfo descendant which provides the new member's metadata.


The CreateMember method allows custom members to be created dynamically.


The following sample code shows how to create custom fields using the XPClassInfo.CreateMember method.

using DevExpress.Xpo;
using DevExpress.Xpo.Metadata;
// ...

XPClassInfo customerClassInfo = Session.DefaultSession.GetClassInfo(typeof(Customer));
customerClassInfo.CreateMember("Name", typeof(string));
customerClassInfo.CreateMember("CompanyName", typeof(string));
customerClassInfo.CreateMember("Orders", typeof(XPCollection), true, 
    new AssociationAttribute("CustomerOrders", typeof(Order)), new AggregatedAttribute());
See Also