Contains extension methods for ITargetContainer to create targets which alias others by different types.
public static class AliasTargetContainerExtensions
RegisterAlias(ITargetContainer, Type, Type)
Registers an alias for one type to another type.
The created entry will effectively represent a second Resolve call into the container for the aliased type.
public static void RegisterAlias(this ITargetContainer targetContainer, Type aliasType, Type originalType)
The builder in which the alias is to be registered
The type to be registered as an alias
The type being aliased.
Use this when it's important that a given target type is always served through the same compiled target, even when the consumer
expects it to be of a different type. A very common scenario is when you have a singleton instance of the
and need to serve that same instance for
aliasType. If you register the same singleton for both types, you get two
separate singletons for each type, whereas if you create an alias, both will be served by the same alias.
Generic version of RegisterAlias(ITargetContainer, Type, Type), see that method for more.
public static void RegisterAlias<TAlias, TOriginal>(this ITargetContainer targetContainer)
The target container in which the alias is to be registered
Type being registered as an alias to another type
The target type of the alias.