public void Save(IMemberGroup memberGroup, bool raiseEvents = true) { if (string.IsNullOrWhiteSpace(memberGroup.Name)) { throw new InvalidOperationException("The name of a MemberGroup can not be empty"); } using (var scope = ScopeProvider.CreateScope()) { var saveEventArgs = new SaveEventArgs <IMemberGroup>(memberGroup); if (raiseEvents && scope.Events.DispatchCancelable(Saving, this, saveEventArgs)) { scope.Complete(); return; } _memberGroupRepository.Save(memberGroup); scope.Complete(); if (raiseEvents) { saveEventArgs.CanCancel = false; scope.Events.Dispatch(Saved, this, saveEventArgs); } } }
public void Save(IMemberGroup memberGroup, bool raiseEvents = true) { using (var scope = ScopeProvider.CreateScope()) { var saveEventArgs = new SaveEventArgs <IMemberGroup>(memberGroup); if (raiseEvents && scope.Events.DispatchCancelable(Saving, this, saveEventArgs)) { scope.Complete(); return; } _memberGroupRepository.Save(memberGroup); scope.Complete(); if (raiseEvents) { saveEventArgs.CanCancel = false; scope.Events.Dispatch(Saved, this, saveEventArgs); } } }