Created
May 15, 2017 17:25
-
-
Save jwChung/7cfd837198d1b0de9920ac6cdd103f2a to your computer and use it in GitHub Desktop.
UserStore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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