I've registered several types in Unity and given them type aliases as follows:
<typeAliases>
<typeAlias alias="MyType" type="foo.bar.MyType, foo.bar" />
</typeAliases>
Is it possible to resolve these types by from the container using the aliased name (as opposed to by type), along the lines of:
var myType = container.ResolveByTypeAlias("MyType")
I can't see any way to do this, but wondered if I've missed something.
No, aliases exist only in the XML configuration. i.e. they only exist at configuration type.
http://msdn.microsoft.com/en-us/library/ff660933(v=pandp.20).aspx details this
Aliases only exist at configuration time. They are not available at run time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With