/src/LinFu.IoC/Interfaces/IFactoryStorage.cs

http://github.com/philiplaureano/LinFu · C# · 39 lines · 11 code · 4 blank · 24 comment · 0 complexity · a3009f084c4ff47b8717dcac77fa27d6 MD5 · raw file

  1. using System.Collections.Generic;
  2. namespace LinFu.IoC.Interfaces
  3. {
  4. /// <summary>
  5. /// Represents a class that stores factory instances.
  6. /// </summary>
  7. public interface IFactoryStorage
  8. {
  9. /// <summary>
  10. /// Gets a value indicating the list of <see cref="IServiceInfo" /> objects
  11. /// that describe each available factory in the current <see cref="IFactoryStorage" />
  12. /// instance.
  13. /// </summary>
  14. IEnumerable<IServiceInfo> AvailableFactories { get; }
  15. /// <summary>
  16. /// Determines which factories should be used
  17. /// for a particular service request.
  18. /// </summary>
  19. /// <param name="serviceInfo">The <see cref="IServiceInfo" /> object that describes the target factory.</param>
  20. /// <returns>A factory instance.</returns>
  21. IFactory GetFactory(IServiceInfo serviceInfo);
  22. /// <summary>
  23. /// Adds a <see cref="IFactory" /> to the current <see cref="IFactoryStorage" /> object.
  24. /// </summary>
  25. /// <param name="serviceInfo">The <see cref="IServiceInfo" /> object that describes the target factory.</param>
  26. /// <param name="factory">The <see cref="IFactory" /> instance that will create the object instance.</param>
  27. void AddFactory(IServiceInfo serviceInfo, IFactory factory);
  28. /// <summary>
  29. /// Determines whether or not a factory exists in storage.
  30. /// </summary>
  31. /// <param name="serviceInfo">The <see cref="IServiceInfo" /> object that describes the target factory.</param>
  32. /// <returns>Returns <c>true</c> if the factory exists; otherwise, it will return <c>false</c>.</returns>
  33. bool ContainsFactory(IServiceInfo serviceInfo);
  34. }
  35. }