Exemple #1
0
        /// <summary>
        /// Updates the 'entry point' setting within a context block.
        /// </summary>
        /// <param name="entryPoint">The name of the entry point.</param>
        /// <param name="append">if set to <c>true</c> [append].</param>
        /// <returns></returns>
        private static IDisposable SetEntryPoint(string entryPoint, bool append)
        {
            var    context       = RequestContext.GetContext( );
            string oldEntryPoint = _entryPoint;

            _entryPoint = append ? (oldEntryPoint ?? "") + "/" + entryPoint : entryPoint;

            return(ContextHelper.Create(() =>
            {
                _entryPoint = oldEntryPoint;
            }));
        }
        /// <summary>
        ///     Default constructor for the ContextBlock object.
        /// </summary>
        public ContextBlock(Action setContextAction)
        {
            if (RequestContext.IsSet)
            {
                /////
                // Cache the original context.
                /////
                _originalContextData = RequestContext.GetContext( );
            }

            /////
            // Set the specific context.
            /////
            setContextAction( );
        }