Created
March 24, 2011 02:57
-
-
Save darrencauthon/884461 to your computer and use it in GitHub Desktop.
Example from Karl
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 UserRepository | |
{ | |
private readonly IDataStore _store; | |
private readonly IEncryption _encryption; | |
public UserRepository(IDataStore store, IEncryption encryption) | |
{ | |
_store = store; | |
_encryption = encryption; | |
} | |
public User FindByCredentials(string username, string password) | |
{ | |
var user = _store.FindOneByNamedQuery("FindUserByUserName", username); | |
if (user == null) { return null; } | |
return _encryption.CheckPassword(user.Password, password) ? user : null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment