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.v24.2.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 |
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