/// <summary> /// Registers a <see langword="delegate"/> to invoke to provide an instance when the base /// type is requested. /// </summary> /// <exception cref="ArgumentNullException"> /// <paramref name="baseType"/> or <paramref name="activationDelegate"/> /// </exception> /// <param name="baseType"> Type that will be requested in the future. </param> /// <param name="activationDelegate"> The activation <see langword="delegate"/> to invoke. </param> public static void RegisterProvider( [NotNull] this Type baseType, [NotNull] Delegate activationDelegate) { //- Validate if (baseType == null) { throw new ArgumentNullException(nameof(baseType)); } if (activationDelegate == null) { throw new ArgumentNullException(nameof(activationDelegate)); } // Register with the common provider CommonProvider.Register(baseType, activationDelegate); }
/// <summary> /// Registers a preferred type as the type to provide when the base type is requested. /// </summary> /// <param name="baseType"><see cref="Type"/> that will be requested in the future.</param> /// <param name="preferredType"><see cref="Type"/> to instantiate instead of the base type.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="baseType"/> or <paramref name="preferredType"/> /// </exception> public static void RegisterProvider( [NotNull] this Type baseType, [NotNull] Type preferredType) { //- Validate if (baseType == null) { throw new ArgumentNullException(nameof(baseType)); } if (preferredType == null) { throw new ArgumentNullException(nameof(preferredType)); } // Register with the common provider CommonProvider.Register(baseType, preferredType); }