|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using Unity.Lifetime; |
| 4 | +using Unity.Registration; |
| 5 | + |
| 6 | +namespace Unity.Builder.Strategy |
| 7 | +{ |
| 8 | + public interface IRegisterStrategy |
| 9 | + { |
| 10 | + /// <summary> |
| 11 | + /// Register a type mapping with the container, where the created instances will use |
| 12 | + /// the given <see cref="LifetimeManager"/>. |
| 13 | + /// </summary> |
| 14 | + /// <param name="typeFrom"><see cref="Type"/> that will be requested.</param> |
| 15 | + /// <param name="typeTo"><see cref="Type"/> that will actually be returned.</param> |
| 16 | + /// <param name="name">Name to use for registration, null if a default registration.</param> |
| 17 | + /// <param name="lifetimeManager">The <see cref="LifetimeManager"/> that controls the lifetime |
| 18 | + /// of the returned instance.</param> |
| 19 | + /// <param name="injectionMembers">Injection configuration objects. Can be null.</param> |
| 20 | + /// <returns>List of policies this registration generates.</returns> |
| 21 | + IEnumerable<IBuilderPolicy> RegisterType(Type typeFrom, Type typeTo, string name, LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers); |
| 22 | + |
| 23 | + /// <summary> |
| 24 | + /// Register an instance with the container. |
| 25 | + /// </summary> |
| 26 | + /// <remarks> |
| 27 | + /// <para> |
| 28 | + /// Instance registration is much like setting a type as a singleton, except that instead |
| 29 | + /// of the container creating the instance the first time it is requested, the user |
| 30 | + /// creates the instance ahead of type and adds that instance to the container. |
| 31 | + /// </para> |
| 32 | + /// </remarks> |
| 33 | + /// <param name="type">Type of instance to register (may be an implemented interface instead of the full type).</param> |
| 34 | + /// <param name="instance">Object to returned.</param> |
| 35 | + /// <param name="name">Name for registration.</param> |
| 36 | + /// <param name="lifetime"> |
| 37 | + /// <see cref="LifetimeManager"/> object that controls how this instance will be managed by the container.</param> |
| 38 | + /// <returns>List of policies this registration generates.</returns> |
| 39 | + IEnumerable<IBuilderPolicy> RegisterInstance(Type type, string name, object instance, LifetimeManager lifetime); |
| 40 | + |
| 41 | + } |
| 42 | +} |
0 commit comments