public static IContainerAdapter RegisterSingletonTypeIfMissing <TFrom, TTo>(this IContainerAdapter adapter) where TTo : TFrom { { Lokad.Enforce.Argument(() => adapter); } return(adapter.RegisterTypeIfMissing <TFrom, TTo>(ContainerRegistrationScope.Singleton)); }
/// <summary> /// Registers a type in the container only if that type was not already registered. /// </summary> /// <param name="adapter">The extended adapter.</param> /// <param name="fromType">The registration type.</param> /// <param name="toType">The type implementing the registration type.</param> /// <returns> /// The <see cref="IContainerAdapter"/> with the newly registered value. /// </returns> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="adapter"/> is <see langword="null" />. /// </exception> public static IContainerAdapter RegisterSingletonTypeIfMissing( this IContainerAdapter adapter, Type fromType, Type toType) { { Lokad.Enforce.Argument(() => adapter); } return(adapter.RegisterTypeIfMissing(fromType, toType, ContainerRegistrationScope.Singleton)); }