-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store does not implement IQueryableUserStore<TUser> #5
Comments
This is due to the azure storage library not supporting linq queries. Any help on implementing the expression filter would be appreciated and kind of tricky to make it perform well. |
There is an implementation of IQueryable at https://github.com/dtretyakov/WindowsAzure. Personally I would be inclined to get a list of users another way :) |
I implemented a single sign-on service using this David's ElCamino table storage provider. One of the requirement was to get all Users loaded in memory at the application startup (singleton service). Although bit of a performance hit, but I managed to simulate the "IQueryably get-all-users" behavior using this patch (on top of some old commit.. from Codeplex days): - IUserLoginStore<TUser>
- , IUserClaimStore<TUser>
+ IUserLoginStore<TUser>,
+ IQueryableUserStore<TUser>, IUserClaimStore<TUser>
, IUserRoleStore<TUser>
, IUserPasswordStore<TUser>
, IUserSecurityStampStore<TUser>
@@ -223,6 +223,9 @@ await Task.WhenAll(_userTable.ExecuteAsync(TableOperation.Insert(item), cancella
try
{
await Task.WhenAll(tasks.ToArray());
+ var listified = _allUsers.ToList();
+ listified.Add(user);
+ _allUsers = listified.AsQueryable();
return IdentityResult.Success;
}
catch (AggregateException aggex)
@@ -832,7 +835,7 @@ public virtual Task<bool> IsInRoleAsync(TUser user, string roleName, Cancellatio
user.Roles.Remove(item);
TableOperation deleteOperation = TableOperation.Delete(item);
- await _userTable.ExecuteAsync(deleteOperation);
+ await _userTable.ExecuteAsync(deleteOperation, cancellationToken);
}
}
@@ -1126,6 +1129,10 @@ private TUser ChangeUserName(TUser user)
public TContext Context { get; private set; }
+ private IQueryable<TUser> _allUsers;
+
+ public IQueryable<TUser> Users => _allUsers ??
+ (_allUsers = GetUsersAggregateAsync(new TableQuery()).Result.AsQueryable()); Each time a user is created, it updates the in-memory cache. The 'onion' architecture of ASP.NET Identity f/w eventually calls this Note that it is an unwarranted territory as the framework internally re-instantiates the store object at different occasions, so it ends up calling |
There may be some hope to bring this back with the Storage team looking to bring back linq in netstandard2.0 release: Azure/azure-storage-net#491 |
Just a quick question - is this related to the 'Users' not implemented error. I'm trying to get the user's telephone number by calling FindByEmail (which is used by resetpassword as well) and I'm getting an exception/null reference: 'this._userManager.Users' threw an exception of type 'System.NotImplementedException' (if there's another way, I'd greatly appreciate the advise) Thanks much, Eyal |
Putting this into v5 for basic query functionality. |
fixed in v5-rc2. |
Hi,
when I try to get all users stored in aspnetusers table:
var users = _userManager.Users;
I get this error
NotSupportedException: Store does not implement IQueryableUserStore.
get_Users
thank you
The text was updated successfully, but these errors were encountered: