Back to Devexpress

EditorAliasAttribute Class

expressappframework-devexpress-dot-persistent-dot-base-10d7c0da.md

latest3.8 KB
Original Source

EditorAliasAttribute Class

Specifies the Property Editor alias.

Namespace : DevExpress.Persistent.Base

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

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

Remarks

To assign a property editor to a specific business class’ property, you can use the IModelCommonMemberViewItem.PropertyEditorType property of the BOModel | <Class> | OwnMembers | <Member> node in the Model Editor. Most Property Editors are platform-specific, and you cannot specify the editor type in the common module.

To assign an alias, you can use the PropertyEditorAttribute constructor that takes the alias parameter.

csharp
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Blazor.Editors;
// ...
[PropertyEditor(typeof(string), "MyStringPropertyEditorAlias", false)]
public class MyBlazorStringPropertyEditor : BlazorPropertyEditorBase {
    // ...
}
csharp
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Win.Editors;
// ...
[PropertyEditor(typeof(string), "MyObjectPropertyEditorAlias", false)]
public class MyWinStringPropertyEditor : StringPropertyEditor {
    // ...
}

Now, you can passMyStringPropertyEditorAlias to the EditorAliasAttribute to specify the property editor type of your business object in code without the use of the Model Editor.

If this attribute is applied to a property, then the property editor associated with the specified alias will be used for this property.

csharp
[EditorAlias("MyStringPropertyEditorAlias")]
public string SimpleProperty { get; set; }

If this attribute is applied to a business class, then the property editor associated with the specified alias will be used for all reference properties of the target type.

csharp
[EditorAlias("MyObjectPropertyEditorAlias")]
public class MyBusinessObject { 
    //...
}

Caution

If the propertyType parameter value is not a Object type, do not use built-in editor aliases. If you need to register a custom editor for a built-in alias, use the solution from the ModuleBase topic.

Inheritance

Object Attribute EditorAliasAttribute

See Also

EditorAliasAttribute Members

DevExpress.Persistent.Base Namespace