Back to Devexpress

XPDictionary.CreateClass(String, Attribute[]) Method

xpo-devexpress-dot-xpo-dot-metadata-dot-xpdictionary-dot-createclass-x28-system-dot-string-system-dot-attribute-x29.md

latest3.2 KB
Original Source

XPDictionary.CreateClass(String, Attribute[]) Method

Creates a class with the specified name and attributes.

Namespace : DevExpress.Xpo.Metadata

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public XPClassInfo CreateClass(
    string className,
    params Attribute[] attributes
)
vb
Public Function CreateClass(
    className As String,
    ParamArray attributes As Attribute()
) As XPClassInfo

Parameters

NameTypeDescription
classNameString

A String value that specifies the class name.

| | attributes | Attribute[] |

An array of attributes.

|

Returns

TypeDescription
XPClassInfo

The XPClassInfo for the created class.

|

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CreateClass(String, Attribute[]) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-mvc-grid-custom-binding-and-xpo/CS/XPCustomBindingExample/XPO/DatabaseSchemaHelper.cs#L10

csharp
XPClassInfo ordersTable = dictionary.CreateClass("Order");
ordersTable.CreateMember("ID", typeof(int), new KeyAttribute(true));

asp-net-mvc-grid-custom-binding-and-xpo/VB/XPCustomBindingExample/XPO/DatabaseSchemaHelper.vb#L14

vb
Dim ordersTable As XPClassInfo = dictionary.CreateClass("Order")
ordersTable.CreateMember("ID", GetType(Integer), New KeyAttribute(True))

See Also

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

XPDictionary Class

XPDictionary Members

DevExpress.Xpo.Metadata Namespace