Admin Identity Users UI without Entity Framework

Hi,

I’m using Identity Auth with my own UserStore and RoleStore (each using OrmLite instead of Entity Framework for persistance)
These stores implements all the needed interfaces, particularly IQueryableRoleStore and IQueryableUserStore.

builder.Services.AddAuthorization();
builder.Services.AddIdentity<AppUser, AppRole>(options =>
{
})
    .AddUserStore<OrmLiteUserStore2>()
    .AddRoleStore<OrmLiteRoleStore2>()
    .AddSignInManager()
    .AddDefaultTokenProviders();

builder.Services.AddPlugin(new AuthFeature(IdentityAuth.For<AppUser, AppRole, int>(options =>
{
    options.CredentialsAuth();
    options.AdminUsersFeature();
})));

=> I can create users and login to the Admin UI as expected

But my problem is when I try to access to the users or the roles in the Admin UI, nothing is shown…
In my logs I have this error, for user list :

2025-07-01 20:38:56.904 +02:00 [SRC] ServiceStack.DtoUtils [ERR] Failed to resolve DbContext from OrmLiteUserStore2
System.NotSupportedException: Failed to resolve DbContext from OrmLiteUserStore2
   at ServiceStack.Auth.IdentityAuth.ResolveDbContext[TUser](IServiceProvider services) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Extensions/Auth/IdentityAuth.cs:line 180
   at ServiceStack.Auth.IdentityAuthContextManager`3.SearchUsersAsync(String query, String orderBy, Nullable`1 skip, Nullable`1 take, IRequest request) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Extensions/Auth/IdentityAuth.cs:line 428
   at ServiceStack.Auth.IdentityAdminUsersFeature`3.SearchUsersAsync(IRequest request, String query, String orderBy, Nullable`1 skip, Nullable`1 take) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Extensions/Auth/AdminIdentityUsersFeature.cs:line 193
   at ServiceStack.Auth.AdminIdentityUsersService.Get(AdminQueryUsers request) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Extensions/Auth/AdminIdentityUsersFeature.cs:line 456
   at ServiceStack.Host.ServiceRunner`1.ExecuteAsync(IRequest req, Object instance, TRequest requestDto) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Host/ServiceRunner.cs:line 149

Maybe it’s possible for IdentityAuthContextManager.SearchUsersAsync method to use IQueryableUserStore.Users instead of DbContext ?

For roles the error is

2025-07-01 20:54:16.374 +02:00 [SRC] ServiceStack.DtoUtils [ERR] The source 'IQueryable' doesn't implement 'IAsyncEnumerable<Tmpi.Common.ServiceModel.Types.AppRole>'. Only sources that implement 'IAsyncEnumerable' can be used for Entity Framework asynchronous operations.
System.InvalidOperationException: The source 'IQueryable' doesn't implement 'IAsyncEnumerable<Tmpi.Common.ServiceModel.Types.AppRole>'. Only sources that implement 'IAsyncEnumerable' can be used for Entity Framework asynchronous operations.
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.AsAsyncEnumerable[TSource](IQueryable`1 source)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
   at ServiceStack.Auth.IdentityAuthContextManager`3.<GetAllRolesAsync>g__GetAllRoles|31_0(RoleManager`1 roleManager) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Extensions/Auth/IdentityAuth.cs:line 799
   at ServiceStack.Auth.IdentityAdminUsersFeature`3.GetAllRolesAsync(IRequest request)
   at ServiceStack.Auth.AdminIdentityUsersService.Get(AdminGetRoles request) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Extensions/Auth/AdminIdentityUsersFeature.cs:line 660
   at ServiceStack.Host.ServiceRunner`1.ExecuteAsync(IRequest req, Object instance, TRequest requestDto) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Host/ServiceRunner.cs:line 149

Thank you !

We’ve never supported IdentityAuth with OrmLite backing stores. You should switch to using EF for Identity Auth as done in all Identity Auth Templates which are configured to use EF for all IdentityAuth tables and OrmLite for everything else.

For reference the BlazorDiffusionVue looks like a close match to your configuration which uses custom AppUser and AppRole custom tables and a int primary key.