public override void Dispose() { EfUnitOfWork?.Dispose(); EfUnitOfWork = null; ContextFactory?.Dispose(); ContextFactory = null; }
public void Dispose() { EfUnitOfWork?.Dispose(); EfUnitOfWork = null; _entities = null; ContextFactory?.Dispose(); ContextFactory = null; }
public async Task <bool> Do(RegisteredUserEvent message) { try { var user = _unitOfWork.userRepository.GetByUserName(message.UserName); if (user != null) { user.AssignFirstName(message.FirstName); user.AssignLastName(message.LastName); user.ChangePassword(message.PasswordHash); user.AssignPhoneNumber(message.PhoneNumber); user.AssignEmail(message.Email); user.AssignModifiedDate(DateTime.Now); user.AssignRole((UserRoleEnum)message.Role); _unitOfWork.userRepository.Update(user); await _unitOfWork.CommitAsync(); return(true); } var newUser = User.CreateInstance(null, message.FirstName, message.LastName, message.PasswordHash, message.Email, message.UserName, UserRoleEnum.Student, message.PhoneNumber, true, null, null, message.Description, (LevelEnum)message.Level); await _unitOfWork.userRepository.AddAsync(newUser); await _unitOfWork.CommitAsync(); return(true); } catch (Exception) { _unitOfWork.Dispose(); return(false); } }
public override void Dispose() { _unitOfWork?.Dispose(); _contextFactory?.Dispose(); _contextFactory = null; }
public void Dispose() { _unitOfWork?.Dispose(); }