Skip to main content
.NET 6.0+

Controller.CustomizeTypesInfo(ITypesInfo) Method

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

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public virtual void CustomizeTypesInfo(
    ITypesInfo typesInfo
)

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 a ModuleBase class’ ModuleBase.CustomizeTypesInfo method. It is more suitable when none of the Module’s Controllers are related to the BOModel node customization.

See Also