/// <summary>Sets the new scope as current using existing current as input.</summary> /// <param name="setCurrentScope">Delegate to get new scope.</param> /// <returns>New current scope.</returns> public IScope SetCurrent(SetCurrentScopeHandler setCurrentScope) { var oldScope = GetCurrentOrDefault(); var newScope = setCurrentScope(oldScope); try { _getContextItems()[RootScopeName] = newScope; return(newScope); } catch (Exception ex) { if (_catchScopeContextErrors == null) { throw; } _catchScopeContextErrors(ex); return(oldScope); } }
public IScope SetCurrent(SetCurrentScopeHandler setCurrentScope) { throw new NotSupportedException("Setting the new scope is not supported, because the transaction scope is created automatically."); }
/// <summary>Sets the new scope as current using existing current as input.</summary> /// <param name="setCurrentScope">Delegate to get new scope.</param> /// <returns>Return new current scope.</returns> public IScope SetCurrent(SetCurrentScopeHandler setCurrentScope) { var newCurrentScope = setCurrentScope.ThrowIfNull()(GetCurrentOrDefault()); _getContextItems()[_currentScopeEntryKey] = newCurrentScope; return newCurrentScope; }
public IScope SetCurrent(SetCurrentScopeHandler setCurrentScope) { return(setCurrentScope(new Scope())); }
public IScope SetCurrent(SetCurrentScopeHandler setCurrentScope) => setCurrentScope(new Scope());