Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Account: IEntity<string>
- {
- public string Id { get; }
- public string Username { get; }
- public string Password { get; }
- public Account(string id, string username, string password)
- {
- Id = id;
- Username = username;
- Password = password;
- }
- }
- public interface IEntity<out T>
- {
- T Id { get; }
- }
- public class AccountFactory: IAccountFactory
- {
- private readonly IHashingService _hashingService;
- public AccountFactory(IHashingService hashingService)
- {
- _hashingService = hashingService;
- }
- public Entities.Account Create(string username, string password)
- {
- var id = IdentityBuilder.Build();
- var hashedPassword = _hashingService.HashPassword(password);
- return new Entities.Account(id, username, hashedPassword);
- }
- }
Add Comment
Please, Sign In to add comment