/// <summary> /// Creates a delegate that upon invocation return the current <see cref="Scope"/> for this /// lifestyle and the given <paramref name="container"/>, or null when the delegate is executed outside /// the context of such scope. /// </summary> /// <param name="container">The container for which the delegate gets created.</param> /// <returns>A <see cref="Func{T}"/> delegate. This method never returns null.</returns> protected override Func <Scope> CreateCurrentScopeProvider(Container container) { Requires.IsNotNull(container, nameof(container)); return(() => GetOrCreateScope(container)); }