Namespace and/or assembly aliases?

Jun 17, 2009 at 8:00 PM

My type definitions are including some relatively long definitions formatted like:

<type type="," mapTo=","/>

That is actually short since I have abbreviated org, app and mvp for this example.

Is there a way to create an alias or constant for the namespace or assembly name? ex:

<const name="appmvp" value=""/>
<type type="{appmvp}.presenter.ISomePresenter, {appmvp}" mapTo="{appmvp}.presenter.SomeConcretePresenter, {appmmvp}"/>

Or perhaps there is a way to add assembly references, namespace imports...

Something, anything to make this less verbose?

Thank you,




Jun 18, 2009 at 7:49 AM

Take a look at the <typeAliases> element. It does exactly what you want.


Jun 18, 2009 at 2:38 PM

Not really.  <typeAlias> is aliasing a specific type rather than just a namespace or just an assembly is it not?  That works fine when you're reusing types frequently such as the lifetime types, but for entering all the commands, presenters, etc in an application, where you are just mapping the type one time,  it doesn't provide any reuse.  In fact, it just adds to the workload.

What is needed is a method of performing token substitution as I've shown above.

I have not dug too deep into Unity extensions yet but perhaps there is some sort of ITypeResolver interface that I can plug into which might allow me to perform the type name substitution I am showing above and then pass on to the original/base type resolver.


Jun 20, 2009 at 6:13 AM

<typeAlias> is what we have. The config system doesn't have a whole lot of pluggability, unfortunately.