ModuleBase.CustomizeTypesInfo(ITypesInfo) Method

Customizes business class metadata before loading it to the Application Model's BOModel node.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v18.2.dll

Declaration

public virtual void CustomizeTypesInfo(
    ITypesInfo typesInfo
)
Public Overridable Sub CustomizeTypesInfo(
    typesInfo As ITypesInfo
)

Parameters

Type Name Description
ITypesInfo typesInfo

An ITypesInfo object which holds metadata information on business classes to be loaded to the Application Model.

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.

See Also