Skip to main content
All docs
V25.1
  • .NET 8.0+
    • The page you are viewing does not exist in the .NET Framework 4.6.2+ platform documentation. This link will take you to the parent topic of the current section.

    UserManager.FindUserByKey<TUser>(IObjectSpace, String) Method

    Finds an application user based on the specified user object ID.

    Namespace: DevExpress.ExpressApp.Security

    Assembly: DevExpress.ExpressApp.Security.v25.1.dll

    NuGet Package: DevExpress.ExpressApp.Security

    Declaration

    public TUser FindUserByKey<TUser>(
        IObjectSpace objectSpace,
        string userKey
    )
        where TUser : class, ISecurityUserWithLoginInfo

    Parameters

    Name Type Description
    objectSpace IObjectSpace

    An Object Space used to search for a user.

    userKey String

    A System.String that contains the user ID.

    Type Parameters

    Name Description
    TUser

    The user object type.

    Returns

    Type Description
    TUser

    The resulting user object.

    Remarks

    The following code snippet demonstrates how to use the FindUserByKey method to find a user based on the user object’s key value:

    using DevExpress.ExpressApp.Security;
    using Microsoft.Extensions.DependencyInjection;
    // ...
    // Use Dependency Injection to access the IServiceProvider.
    var userManager = serviceProvider.GetRequiredService<UserManager>();
    ApplicationUser user = userManager.FindUserByKey<ApplicationUser>(os, userKeyValue);
    
    See Also