PageRenderTime 82ms CodeModel.GetById 77ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/LinFu.IoC/ServiceRequest.cs

http://github.com/philiplaureano/LinFu
C# | 66 lines | 23 code | 9 blank | 34 comment | 0 complexity | f3b93fdb237d8bdd1d64b426b790d214 MD5 | raw file
 1using System;
 2using LinFu.IoC.Interfaces;
 3
 4namespace LinFu.IoC
 5{
 6    /// <summary>
 7    ///     Reprsents the default implementation of the <see cref="IServiceRequest" /> interface.
 8    /// </summary>
 9    internal class ServiceRequest : ServiceInfo, IServiceRequest
10    {
11        /// <summary>
12        ///     Initializes the <see cref="ServiceRequest" /> class.
13        /// </summary>
14        /// <param name="serviceName">The name of the requested service.</param>
15        /// <param name="serviceType">The requested service type.</param>
16        /// <param name="proposedArguments">The proposed set of arguments that will be given to the factory.</param>
17        /// <param name="proposedFactory">The <see cref="IFactory" /> instance that will be used to handle the service request.</param>
18        /// <param name="container">The host container.</param>
19        internal ServiceRequest(string serviceName, Type serviceType,
20            object[] proposedArguments, IFactory proposedFactory, IServiceContainer container)
21            : base(serviceName, serviceType)
22        {
23            ProposedArguments = proposedArguments;
24            ProposedFactory = proposedFactory;
25            Container = container;
26
27            // The proposed arguments
28            // will match the actual arguments by default
29            ActualArguments = proposedArguments;
30
31            // The same rule applies to the ActualFactory
32            // property
33            ActualFactory = proposedFactory;
34        }
35
36
37        /// <summary>
38        ///     Gets the value indicating the original arguments that
39        ///     were given during the service request.
40        /// </summary>
41        public object[] ProposedArguments { get; }
42
43        /// <summary>
44        ///     Gets the value indicating the original <see cref="IFactory" /> instance
45        ///     that will be used to handle the service request.
46        /// </summary>
47        public IFactory ProposedFactory { get; }
48
49        /// <summary>
50        ///     The container that will handle the service request.
51        /// </summary>
52        public IServiceContainer Container { get; }
53
54        /// <summary>
55        ///     Gets or sets the value indicating the actual arguments that
56        ///     will be used for the service request.
57        /// </summary>
58        public object[] ActualArguments { get; set; }
59
60        /// <summary>
61        ///     Gets or sets the value indicating the actual <see cref="IFactory" /> instance
62        ///     that will be used to handle the service request.
63        /// </summary>
64        public IFactory ActualFactory { get; set; }
65    }
66}