PageRenderTime 102ms CodeModel.GetById 61ms app.highlight 1ms RepoModel.GetById 39ms app.codeStats 0ms

/src/LinFu.IoC/CompositePreProcessor.cs

http://github.com/philiplaureano/LinFu
C# | 34 lines | 17 code | 4 blank | 13 comment | 0 complexity | 23d04ff4681a59fa1f189af0ee85b1ec MD5 | raw file
 1using System.Collections.Generic;
 2using LinFu.IoC.Interfaces;
 3
 4namespace LinFu.IoC
 5{
 6    /// <summary>
 7    ///     Represents an <see cref="IPreProcessor" /> type that processes multiple <see cref="IPreProcessor" /> instances at
 8    ///     once.
 9    /// </summary>
10    internal class CompositePreProcessor : IPreProcessor
11    {
12        private readonly IEnumerable<IPreProcessor> _preProcessors;
13
14        /// <summary>
15        ///     Initializes the type using the given <paramref name="preProcessors" />.
16        /// </summary>
17        /// <param name="preProcessors">The list of <see cref="IPreProcessor" /> instances that will be handled by this type.</param>
18        public CompositePreProcessor(IEnumerable<IPreProcessor> preProcessors)
19        {
20            _preProcessors = preProcessors;
21        }
22
23
24        /// <summary>
25        ///     A method that passes every request result made
26        ///     to the list of preprocessors.
27        /// </summary>
28        /// <param name="request">The parameter that describes the context of the service request.</param>
29        public void Preprocess(IServiceRequest request)
30        {
31            foreach (var preprocessor in _preProcessors) preprocessor.Preprocess(request);
32        }
33    }
34}