UnityBootstrapper RegisterTypesIfMissing when types reside in assemblies that are not refrenced

60 Views Asked by At

I am struggling to register concrete implementation of an interface in a Prism application when the assembly that contains the implementing type is not referenced. It is fine if this can be done through configuration.

Consider this code:

RegisterTypeIfMissing(typeof(IHostData), NOT_REFERENCED_ASSEMBLY_TYPE, true);
1

There are 1 best solutions below

0
On BEST ANSWER

I would recommend you look at Unity's registration by convention ability. Specifically, the AllClasses helper allows you to locate types within an assembly or many assemblies to register. You could use reflection to load the assembly and pass it to this helper, or you could use the AllClasses.FromAssembliesInBasePath method to have Unity load the assembly for you. Also take a look at How the Runtime Locates Assemblies.