/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

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