예제 #1
0
 /// <summary>Registers a <see cref="Rezolver.Targets.DelegateTarget" /> built from a factory delegate which takes 5 arguments
 /// and which returns an instance of <typeparamref name="TResult" /></summary>
 /// <typeparam name="T1">Type of the 1st delegate parameter</typeparam>
 /// <typeparam name="T2">Type of the 2nd delegate parameter</typeparam>
 /// <typeparam name="T3">Type of the 3rd delegate parameter</typeparam>
 /// <typeparam name="T4">Type of the 4th delegate parameter</typeparam>
 /// <typeparam name="T5">Type of the 5th delegate parameter</typeparam>
 /// <typeparam name="TResult">The type of the object produced by the factory delegate.</typeparam>
 /// <param name="targets">Required.  The <see cref="ITargetContainer" /> into which the newly created target will be registered</param>
 /// <param name="factory">Required.  The factory delegate which is to be executed when an instance is resolved by a container</param>
 /// <param name="declaredType">Optional.  The <see cref="ITarget.DeclaredType" /> of the target to be created
 /// if different from <typeparamref name="TResult" />.  Also overrides the type against which the registration will be made.</param>
 /// <param name="scopeBehaviour">Optional.  Controls how the object generated from the factory delegate will be
 /// tracked if the target is executed within an <see cref="ContainerScope" />.  The default is <see cref="ScopeBehaviour.Implicit" />.</param>
 /// <param name="scopePreference">If <paramref name="scopeBehaviour"/> is not <see cref="ScopeBehaviour.None"/>, then this controls the preferred scope for the instance to be tracked.  Defaults to <see cref="ScopePreference.Current"/></param>
 public static void RegisterDelegate <T1, T2, T3, T4, T5, TResult>(this ITargetContainer targets, Func <T1, T2, T3, T4, T5, TResult> factory, Type declaredType = null, ScopeBehaviour scopeBehaviour = ScopeBehaviour.Implicit, ScopePreference scopePreference = ScopePreference.Current)
 {
     targets.RegisterDelegate((Delegate)factory, declaredType, scopeBehaviour, scopePreference);
 }