Back to Devexpress

XPDictionary.GetClassInfo(Type) Method

xpo-devexpress-dot-xpo-dot-metadata-dot-xpdictionary-dot-getclassinfo-x28-system-dot-type-x29.md

latest5.6 KB
Original Source

XPDictionary.GetClassInfo(Type) Method

Returns the persistent class metadata information for the specified class type.

Namespace : DevExpress.Xpo.Metadata

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public XPClassInfo GetClassInfo(
    Type classType
)
vb
Public Function GetClassInfo(
    classType As Type
) As XPClassInfo

Parameters

NameTypeDescription
classTypeType

The class type.

|

Returns

TypeDescription
XPClassInfo

The XPClassInfo for the specified class type.

|

Remarks

This method throws the CannotResolveClassInfoException whenever the metadata information cannot be obtained for the specified class type; for example, if the corresponding class does not implement IXPSimpleObject an exception is thrown.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetClassInfo(Type) 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.

XPO_how-to-persist-metadata-e269/CS/MetadataObjects.cs#L57

csharp
else
    baseClassInfo = dictionary.GetClassInfo(GetDefaultBaseClass());
result = dictionary.CreateClass(baseClassInfo, Name);

XAF_generate-a-sequential-number-for-a-persistent-object-within-a-database-transaction/CS/XPO/SequenceGenerator/SequenceGenerator.Module/SequenceClasses/SequenceGenerator.cs#L121

csharp
Guard.ArgumentNotNull(typeInfo, "typeInfo");
    return GetNextSequence(XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary.GetClassInfo(typeInfo.Type));
}

XPO_how-to-define-a-persistent-class-at-runtime-e1139/CS/CreateClassAtRuntime/Program.cs#L16

csharp
XPDictionary dictionary = new ReflectionDictionary();
XPClassInfo myBaseClass = dictionary.GetClassInfo(typeof(MyBaseObject));
XPClassInfo myClassA = dictionary.CreateClass(myBaseClass, "MyObjectA");

XPO_how-to-dynamically-create-a-read-only-calculated-persistent-alias-property-e3473/CS/ConsoleApplication17/Program.cs#L26

csharp
XPClassInfo ci = XpoDefault.DataLayer.Dictionary.GetClassInfo(typeof(TestClass));
ci.CreateAliasedMember("DisplayName", typeof(string), "concat([Name],' (',[Email],')',iif([Master] is null,'',Concat(' managed by ',[Master].Name)))");

XPO_how-to-generate-persistent-metadata-for-an-arbitrary-data-table-e2922/CS/MapArbitraryDatabaseExample/Program.cs#L37

csharp
throw new NotSupportedException("Compound primary keys are not supported");
XPClassInfo classInfo = dict.CreateClass(dict.GetClassInfo(typeof(BasePersistentClass)), table.Name.Replace('.', '_'));
classInfo.AddAttribute(new PersistentAttribute(table.Name));

XPO_how-to-persist-metadata-e269/VB/MetadataObjects.vb#L80

vb
Else
    baseClassInfo = dictionary.GetClassInfo(GetDefaultBaseClass())
End If

winforms-filtercontrol-implement-ifilteredcomponent/VB/Q200298/Helper.vb#L144

vb
Dim dict As XPDictionary = CType(sourceField, IXPDictionaryProvider).Dictionary
Dim cInfo As XPClassInfo = dict.GetClassInfo(member.MemberType)
If Equals(element, "!Key") Then element = cInfo.KeyProperty.Name

See Also

GetClassInfo

XPDictionary Class

XPDictionary Members

DevExpress.Xpo.Metadata Namespace