Skip to content

Instantly share code, notes, and snippets.

@darrencauthon
Created March 24, 2011 02:57
Show Gist options
  • Save darrencauthon/884461 to your computer and use it in GitHub Desktop.
Save darrencauthon/884461 to your computer and use it in GitHub Desktop.
Example from Karl
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