I am trying to understand vNext.
I wrote a custom UserStore that works with MongoDB and implements these interfaces:
public class UserStore : IUserStore<ApplicationUser>, IUserPasswordStore<ApplicationUser>, IUserSecurityStampStore<ApplicationUser>, IUserLoginStore<ApplicationUser>, IUserClaimStore<ApplicationUser>, IUserEmailStore<ApplicationUser>, IUserRoleStore<ApplicationUser>, IUserTwoFactorStore<ApplicationUser>
In Startup.cs added:
app.UseServices(services => { services.AddIdentity<ApplicationUser>() .AddUserStore(() => { return new UserStore(); }) .AddUserManager<UserManager<ApplicationUser>>() .AddHttpSignIn(); services.AddMvc(); });
Then I tried to use the immutable AccountController from the Visual Studio template and have problems.
On entering, I get an ObjectDisposedException in UserStore.FindByNameAsync () - what is called UserStore.Dispose ().
In the UserManager code on github.com/aspnet Store.Dispose () is called only in UserManager.Dispose ().
I can just ignore the Dispose calls and everything works fine, but that is not good.
So I have no idea what to do
PS Question: what (and why) can cause UserStore.Dispose ()?
source share