Back to Devexpress

ModelDefaultAttribute Class

expressappframework-devexpress-dot-expressapp-dot-model-2a3b84f4.md

latest3.3 KB
Original Source

ModelDefaultAttribute Class

Specifies default settings that are considered when generating the Application Model node related to the target.

Namespace : DevExpress.ExpressApp.Model

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface, Inherited = true, AllowMultiple = true)]
public sealed class ModelDefaultAttribute :
    Attribute
vb
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Interface, Inherited:=True, AllowMultiple:=True)>
Public NotInheritable Class ModelDefaultAttribute
    Inherits Attribute

Remarks

  • When applied to a business class, specifies the default value of the Application Model’s BOModel | <Class> node property.
  • When applied to a business class’ member, specifies the default value of the Application Model’s BOModel | <Class> | OwnMembers | <Member> node property.

The PropertyName parameter specifies the property name, and the PropertyValue specifies the string representation of the default value. Refer to the following topics to see available properties:

The code below sets the BOModel | DemoTask node’s Caption property to “Task” and ImageName - to “Tasks”. If you customize this value in the Model Editor and later reset this customization, the values will be “Task” and “Tasks” again.

csharp
using DevExpress.ExpressApp.Model;
// ...
[ModelDefault("Caption", "Task"), ModelDefault("ImageName", "Tasks")]
public class DemoTask : Task {
    // ...
}

Inheritance

Object Attribute ModelDefaultAttribute

See Also

ModelDefaultAttribute Members

Data Annotation Attributes

DevExpress.ExpressApp.Model Namespace