Back to Devexpress

XPClassInfo Class

xpo-devexpress-dot-xpo-dot-metadata-ff96a63b.md

latest8.3 KB
Original Source

XPClassInfo Class

Serves as a base for classes that provide metadata information for a class.

Namespace : DevExpress.Xpo.Metadata

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public abstract class XPClassInfo :
    XPTypeInfo,
    IXPClassInfoProvider,
    IXPDictionaryProvider
vb
Public MustInherit Class XPClassInfo
    Inherits XPTypeInfo
    Implements IXPClassInfoProvider,
               IXPDictionaryProvider

The following members return XPClassInfo objects:

Show 41 links

Example

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

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

XPClassInfo customerClassInfo = Session.DefaultSession.GetClassInfo(typeof(Customer));
customerClassInfo.CreateMember("Name", typeof(string));
customerClassInfo.CreateMember("CompanyName", typeof(string));
// Set the nonPersistent parameter to true for collection properties
customerClassInfo.CreateMember("Orders", typeof(XPCollection), true, 
    new AssociationAttribute("CustomerOrders", typeof(Order)), new AggregatedAttribute());
vb
Imports DevExpress.Xpo
Imports DevExpress.Xpo.Metadata
' ...

Dim customerClassInfo As XPClassInfo = Session.DefaultSession.GetClassInfo(GetType(Customer))
customerClassInfo.CreateMember("Name", GetType(String))
customerClassInfo.CreateMember("CompanyName", GetType(String))
' Set the nonPersistent parameter to True for collection properties
customerClassInfo.CreateMember("Orders", GetType(XPCollection), True, _
    New AssociationAttribute("CustomerOrders", GetType(Order)), New AggregatedAttribute())

Inheritance

Object XPTypeInfo XPClassInfo ReflectionClassInfo

XPDataObjectClassInfo

See Also

XPClassInfo Members

How to create persistent metadata on the fly and load data from an arbitrary table

How to create an XPClassInfo descendant to dynamically build a persistent class structure

How to create persistent classes mapped to tables with a composite primary key at runtime

How to create collection properties with associations at runtime

How to Generate persistent metadata for an arbitrary data table

How to generate persistent classes at runtime based on a dataset

How to persist metadata

How to get a list of a persistent object's properties

How to define a persistent class at runtime

How to dynamically create a read-only calculated (persistent alias) property

DevExpress.Xpo.Metadata Namespace