/src/LinFu.IoC/Configuration/Interfaces/IUsingLambda.cs

http://github.com/philiplaureano/LinFu · C# · 71 lines · 12 code · 4 blank · 55 comment · 0 complexity · d0bcd10bab40b4373ae4059aa26b54b7 MD5 · raw file

  1. using System;
  2. using LinFu.IoC.Interfaces;
  3. namespace LinFu.IoC.Configuration
  4. {
  5. /// <summary>
  6. /// Represents a fluent class that creates
  7. /// a factory method that will be used
  8. /// in instantiating a specific service instance.
  9. /// </summary>
  10. /// <typeparam name="TService">The service type being instantiated.</typeparam>
  11. public interface IUsingLambda<TService>
  12. {
  13. /// <summary>
  14. /// Creates a service instance using the
  15. /// concrete <typeparamref name="TConcrete" /> type
  16. /// as the implementation for the <typeparamref name="TService" />
  17. /// type.
  18. /// </summary>
  19. /// <typeparam name="TConcrete">
  20. /// The concrete implementation that implements <typeparamref name="TService" />. This class
  21. /// must have a default constructor.
  22. /// </typeparam>
  23. /// <returns>
  24. /// A non-null <see cref="IGenerateFactory{T}" /> instance that will be used to create a factory and add it to a
  25. /// specific container.
  26. /// </returns>
  27. IGenerateFactory<TService> Using<TConcrete>() where TConcrete : TService;
  28. /// <summary>
  29. /// Creates a service instance using the
  30. /// <paramref name="factoryMethod" /> to
  31. /// instantiate the service instance
  32. /// with a particular factory type.
  33. /// </summary>
  34. /// <seealso cref="IGenerateFactory{T}" />
  35. /// <param name="factoryMethod">The factory method that will be used to instantiate the actual service instance.</param>
  36. /// <returns>
  37. /// A non-null <see cref="IGenerateFactory{T}" /> instance that will be used to create a factory and add it to a
  38. /// specific container.
  39. /// </returns>
  40. IGenerateFactory<TService> Using(Func<IServiceContainer, object[], TService> factoryMethod);
  41. /// <summary>
  42. /// Creates a service instance using the
  43. /// <paramref name="factoryMethod" /> to
  44. /// instantiate the service instance
  45. /// with a particular factory type.
  46. /// </summary>
  47. /// <seealso cref="IGenerateFactory{T}" />
  48. /// <param name="factoryMethod">The factory method that will be used to instantiate the actual service instance.</param>
  49. /// <returns>
  50. /// A non-null <see cref="IGenerateFactory{T}" /> instance that will be used to create a factory and add it to a
  51. /// specific container.
  52. /// </returns>
  53. IGenerateFactory<TService> Using(Func<IServiceContainer, TService> factoryMethod);
  54. /// <summary>
  55. /// Creates a service instance using the
  56. /// <paramref name="factoryMethod" /> to
  57. /// instantiate the service instance
  58. /// with a particular factory type.
  59. /// </summary>
  60. /// <param name="factoryMethod">The factory method that will be used to instantiate the actual service instance.</param>
  61. /// <returns>
  62. /// A non-null <see cref="IGenerateFactory{T}" /> instance that will be used to create a factory and add it to a
  63. /// specific container.
  64. /// </returns>
  65. IGenerateFactory<TService> Using(Func<TService> factoryMethod);
  66. }
  67. }