Ticket Q588294
Visible to All Users
Duplicate

XPO Dynamically built classes

created 11 years ago

We are building a XAF project using XPO. Our goal is to provide a base data model for our clients to capture their primary business collected information. However, each of our clients have the need to collect additional information which is not known to us at the time of development. As such we would like to allow the end-user to create additional tables and data columns to capture their unique information.

Our goal is to allow the clients to specify the table name to be attached to their application. Our XAF application could then use this information to display grid and detail forms to allow end-users access to the additional table information. My first impression of the proper solution is to build the XPO class at run time. Is something like this possible?

(A complete solution would include additional metadata such as table relationships as well as data validation requirements but I am trying to achieve the simple recognition of the table first.)

I have researched the DevExpress site and found a similar article:
XPO Data Source - Can I create a dynamic data source?
If this is possible, do you have any sample code that can point me towards adding a table to a XAF project during run time without having the XPO class previously defined?

Thank you in advance,
Tom

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi Tom.
I regret to inform you that this functionality is not currently supported. In many places, XAF expects a real .NET Framework type, while the XPDictionary.CreateClass method creates a metadata record only (the XPClassInfo.ClassType property of the created class always returns the base class type). As a possible way to go, you can generate runtime classes using AssemblyBuilder, which is a bit safer, because for XAF it will be a regular .NET type and thus nothing needs to be overridden to work with it. We do not have an example of this approach, though.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.