Skip to main content

IMemberInfo.AddAttribute(Attribute, Boolean) Method

Dynamically associates the specified attribute with the current member.

Namespace: DevExpress.ExpressApp.DC

Assembly: DevExpress.ExpressApp.v25.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

IMemberInfo AddAttribute(
    Attribute attribute,
    bool skipRefresh
)

Parameters

Name Type Description
attribute Attribute

An attribute to be associated with the current member.

skipRefresh Boolean

true to prevent the Types Info Subsystem from reloading XPDictionary information immediately. In this case, you need to call the XafMemberInfo.Refresh method for each updated member.
false to immediately refresh the type/member metadata.

Returns

Type Description
IMemberInfo

An object that allows you to further interact with member metadata information.

Remarks

public override void CustomizeTypesInfo(DevExpress.ExpressApp.DC.ITypesInfo typesInfo) {
    base.CustomizeTypesInfo(typesInfo);
    CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
    ITypeInfo pType = typesInfo.FindTypeInfo(typeof(PersistentObject1));
    pType.CreateMember("CustomDecimalField", typeof(decimal))
        .AddAttribute(new ModelDefaultAttribute("DisplayFormat", "n2"))
        .AddAttribute(new ModelDefaultAttribute("EditMask", "n2"));
    // ...
    typesInfo.RefreshInfo(typeof(PersistentObject1));
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddAttribute(Attribute, Boolean) 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.

See Also