/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
- using System.Collections.Generic;
- using LinFu.IoC.Interfaces;
- namespace LinFu.IoC
- {
- /// <summary>
- /// Represents an <see cref="IPreProcessor" /> type that processes multiple <see cref="IPreProcessor" /> instances at
- /// once.
- /// </summary>
- internal class CompositePreProcessor : IPreProcessor
- {
- private readonly IEnumerable<IPreProcessor> _preProcessors;
- /// <summary>
- /// Initializes the type using the given <paramref name="preProcessors" />.
- /// </summary>
- /// <param name="preProcessors">The list of <see cref="IPreProcessor" /> instances that will be handled by this type.</param>
- public CompositePreProcessor(IEnumerable<IPreProcessor> preProcessors)
- {
- _preProcessors = preProcessors;
- }
- /// <summary>
- /// A method that passes every request result made
- /// to the list of preprocessors.
- /// </summary>
- /// <param name="request">The parameter that describes the context of the service request.</param>
- public void Preprocess(IServiceRequest request)
- {
- foreach (var preprocessor in _preProcessors) preprocessor.Preprocess(request);
- }
- }
- }