expressappframework-devexpress-dot-expressapp-dot-dc-dot-imemberinfo-dot-addattribute-x28-system-dot-attribute-system-dot-boolean-x29.md
Dynamically associates the specified attribute with the current member.
Namespace : DevExpress.ExpressApp.DC
Assembly : DevExpress.ExpressApp.v25.2.dll
NuGet Package : DevExpress.ExpressApp
IMemberInfo AddAttribute(
Attribute attribute,
bool skipRefresh
)
Function AddAttribute(
attribute As Attribute,
skipRefresh As Boolean
) As IMemberInfo
| 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.
|
| Type | Description |
|---|---|
| IMemberInfo |
An object that allows you to further interact with member metadata information.
|
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.
memberInfo1 = typeInfo1.CreateMember("PersistentObject2s", typeof(DevExpress.Xpo.XPCollection<PersistentObject2>));
memberInfo1.AddAttribute(new DevExpress.Xpo.AssociationAttribute("PersistentObject1-PersistentObject2s", typeof(PersistentObject2)), true);
memberInfo1.AddAttribute(new DevExpress.Xpo.AggregatedAttribute(), true);
See Also