ModuleBase.CustomizeTypesInfo(ITypesInfo) Method
Customizes business class metadata before loading it to the Application Model‘s BOModel node.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Parameters
Name | Type | Description |
---|---|---|
typesInfo | ITypesInfo | An ITypesInfo object which holds metadata information on business classes to be loaded to the Application Model. |
Remarks
When an XAF application is started, the types info system collects metadata information on the application’s business classes. This metadata information is used to generate the BOModel node’s child nodes and initialize their properties. The CustomizeTypesInfo method allows you to customize the collected metadata before it is used to generate the BOModel node. For instance, you can customize information which becomes read-only after the Application Model is generated. Additionally, you can add a custom class, member or attribute. To do this, override the CustomizeTypesInfo method and use the methods supplied by the types info system.
The following code snippet demonstrates how you can add members and attributes to existing business classes via the CustomizeTypesInfo method.
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
//...
public sealed class MyModule : ModuleBase {
//...
public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
base.CustomizeTypesInfo(typesInfo);
ITypeInfo Department = XafTypesInfo.Instance.FindTypeInfo(typeof(Department));
Department.CreateMember("Building", typeof(int));
IMemberInfo DepartmentOffice = Department.FindMember("Office");
DepartmentOffice.AddAttribute(new VisibleInReportsAttribute(false));
}
}
You can perform analogous actions via the Controller.CustomizeTypesInfo method. It is more suitable when a feature that requires BOModel node customization is represented by a Controller.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomizeTypesInfo(ITypesInfo) 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.