Exemple #1
0
 /// <summary>
 /// Adds mapping for handlers of type <typeparamref name="THandler" /> decorated with <typeparamref name="TAttribute"/> to have behavior of type <typeparamref name="TBehaviorImplementation"/>.
 /// </summary>
 /// <typeparam name="TAttribute">Behavior attribute contract.</typeparam>
 /// <typeparam name="THandler">Type of handler</typeparam>
 /// <typeparam name="TBehaviorImplementation">Behavior contract implementor.</typeparam>
 /// <param name="collection">Target behavior collection.</param>
 /// <param name="index">Index to insert mapping at.</param>
 /// <returns>Self (for fluency).</returns>
 public static AttributeBehaviorCollection Add <TAttribute, THandler, TBehaviorImplementation>(this AttributeBehaviorCollection collection)
     where TAttribute : Attribute
     where TBehaviorImplementation : IBehavior <THandler>
 {
     Ensure.NotNull(collection, "collection");
     return(collection.Add(typeof(TAttribute), typeof(TBehaviorImplementation)));
 }