M.Othman
M.Othman

Reputation: 40

Getting the type of properties which belong to an XPO Object

Is there a way to get the type of a property of an XPO Object. Example : my class is User with properties User_name and User_age.

I want to get the type of the User_name which is string in that case, and User_age which is int.

How can I get this information with code?

Upvotes: 0

Views: 869

Answers (1)

Uranus
Uranus

Reputation: 1690

For each persistent class, XPO creates metadata, which you can use to access persistent members and their properties. The Session.GetClassInfo method returns metadata (XPClassInfo) for a given type of object.

XPClassInfo provides the FindMember and GetMember methods to access persistent property definition by its name (XPMemberInfo).

XPMemberInfo provides the MemberType property, which returns the actual type of a corresponding persistent property.

Upvotes: 2

Related Questions