Back to Devexpress

ModuleBase.CustomizeTypesInfo(ITypesInfo) Method

expressappframework-devexpress-dot-expressapp-dot-modulebase-dot-customizetypesinfo-x28-devexpress-dot-expressapp-dot-dc-dot-itypesinfo-x29.md

latest7.4 KB
Original Source

ModuleBase.CustomizeTypesInfo(ITypesInfo) Method

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

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

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

Parameters

NameTypeDescription
typesInfoITypesInfo

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.

csharp
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.

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.

xaf-how-to-change-connection-to-the-database-at-runtime/CS/EFCore/ASP.NETCore/Blazor/RuntimeDbChooser.Module/Module.cs#L28

csharp
public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
    base.CustomizeTypesInfo(typesInfo);
}

xaf-custom-logon-parameters/CS/XPO/WebForms/CustomLogonXPOWeb/CustomLogonXPOWeb.Module/Module.cs#L36

csharp
public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
    base.CustomizeTypesInfo(typesInfo);
    CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);

xaf-how-to-dynamically-change-mask-settings-based-on-the-current-object/CS/XPO/DynamicMask/DynamicMask.Module/Module.cs#L35

csharp
public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
    base.CustomizeTypesInfo(typesInfo);
    CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);

xaf-how-to-use-the-file-attachment-module-with-a-legacy-database/CS/XPO/CustomFileData/CustomFileData.Module/Module.cs#L38

csharp
public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
    base.CustomizeTypesInfo(typesInfo);
    CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);

xaf-customize-xpo-business-model-at-runtime/CS/CustomizeXPOModel/CustomizeXPOModel.Module/Module.cs#L40

csharp
public override void CustomizeTypesInfo(DevExpress.ExpressApp.DC.ITypesInfo typesInfo) {
    base.CustomizeTypesInfo(typesInfo);
    CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);

XAF-CRUD-for-Non-Persistent-Objects-Stored-Remotely/VB/NonPersistentObjectsDemo.Module/Module.vb#L49

vb
Public Overrides Sub CustomizeTypesInfo(ByVal typesInfo As ITypesInfo)
    MyBase.CustomizeTypesInfo(typesInfo)
    CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo)

XAF_how-to-store-file-attachments-in-the-file-system-instead-of-the-database/VB/E965.Module.Web/WebModule.vb#L35

vb
Public Overrides Sub CustomizeTypesInfo(ByVal typesInfo As ITypesInfo)
    MyBase.CustomizeTypesInfo(typesInfo)

See Also

Use Metadata to Customize Business Classes Dynamically

ModuleBase Class

ModuleBase Members

DevExpress.ExpressApp Namespace