Skip to content

Instantly share code, notes, and snippets.

@jwChung
Created May 15, 2017 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwChung/7cfd837198d1b0de9920ac6cdd103f2a to your computer and use it in GitHub Desktop.
Save jwChung/7cfd837198d1b0de9920ac6cdd103f2a to your computer and use it in GitHub Desktop.
UserStore
public class UserStore :
UserStore<User, Role, string, UserLogin, UserRole, UserClaim>
{
private bool disposed;
public UserStore(DbContext context)
: base(context)
{
}
public override Task<User> FindByNameAsync(string userName)
{
this.ThrowIfDisposed();
return this.GetUserAggregateAsync(u => u.UserName == userName);
}
public override Task<User> FindByEmailAsync(string email)
{
this.ThrowIfDisposed();
return this.GetUserAggregateAsync(u => u.Email == email);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
this.disposed = true;
}
private void ThrowIfDisposed()
{
if (this.disposed)
{
throw new ObjectDisposedException(this.GetType().Name);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment