Skip to main content
.NET Framework 4.6.2+

CurrentUserDisplayImageAttribute Class

Applied to business classes that implement a Security System user. Specifies the name of a property that stores the current user photo or avatar icon. Has effect in the ASP.NET Core Blazor UI and New Web UI only.

Namespace: DevExpress.Persistent.Base

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class CurrentUserDisplayImageAttribute :
    Attribute

Remarks

You can pass the name of a property that stores a user image to the CurrentUserDisplayImage attribute to display this image in the application toolbar.

Follow the steps below to extend a user class with a property that stores a user image:

  1. In a user business class, declare a property of the MediaDataObject (XPO/EF Core), Image, or byte[] type.
  2. Apply CurrentUserDisplayImageAttribute to the user class and pass the new property name as its parameter.

    XPO

    using DevExpress.Persistent.Base;
    using DevExpress.Persistent.BaseImpl;
    // ...
    [CurrentUserDisplayImage(nameof(Photo))]
    public class MyAppUser : PermissionPolicyUser, IObjectSpaceLink, ISecurityUserWithLoginInfo {
        // ...
        private MediaDataObject photo;
        public MediaDataObject Photo {
            get { return photo; }
            set { SetPropertyValue(nameof(Photo), ref photo, value); }
        }
    }
    

    EF Core

    using DevExpress.Persistent.Base;
    using DevExpress.Persistent.BaseImpl;
    // ...
    [CurrentUserDisplayImage(nameof(Photo))]
    public class MyAppUser : PermissionPolicyUser, IObjectSpaceLink, ISecurityUserWithLoginInfo {
        // ...
        private MediaDataObject photo;
        public virtual MediaDataObject Photo {
            get { return photo; }
            set { SetReferencePropertyValue(ref photo, value); }
        }
    }
    
  3. In ASP.NET Web Forms applications, invoke the Model Editor, navigate to the Application node, and set the CurrentUserDisplayMode property to CaptionAndImage or Image.

    The CurrentUserDisplayMode property in the Model Editor

The result is demonstrated in the images below:

ASP.NET Core Blazor

Current user image in a Blazor application

ASP.NET Web Forms

CurrentUserImage

Inheritance

Object
Attribute
CurrentUserDisplayImageAttribute
See Also