Skip to main content
.NET 6.0+

EditorAliasAttribute Class

Specifies the Property Editor alias.

Namespace: DevExpress.Persistent.Base

Assembly: DevExpress.ExpressApp.v23.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class EditorAliasAttribute :
    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. If you create a custom Property Editor that has the WinForms and ASP.NET Web Forms versions, you will have to enable it for each platform individually.

However, you can assign the same string alias for both WinForms and ASP.NET Web Forms editors, and use this alias to refer to your editor in a platform-independent manner. To assign an alias, you can use the PropertyEditorAttribute constructor that takes the alias parameter.

WinForms

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

ASP.NET Web Forms

using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Web.Editors.ASPx;
// ...
[PropertyEditor(typeof(string), "MyStringPropertyEditorAlias", false)]
public class MyWebStringPropertyEditor : ASPxStringPropertyEditor {
    // ...
}

Now, you can pass “MyStringPropertyEditorAlias” 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.

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

[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