public T LoadUserByCredentials <T>(IUserCredentials credentials) where T : IEntity, IUser { AssertNotIsNullOrWhiteSpace(credentials.Username, new UsernameMissingException()); AssertNotIsNullOrWhiteSpace(credentials.Password, new PasswordMissingException()); Guid?id = userDataManager.FindUserByCredentials(credentials); AssertHasValue(id, new InvalidCredentialsException(credentials)); return(LoadEntity <T>(id.Value, TYPE_USER)); }