Loading Classes Dynamically

Oct 17, 2006 at 6:40 AM
I have been playing around with the DI container example from the P&P summit. I ran into some difficulty when there isn't a reference to the project where you are loading assemblies from (like you might have in a unit test project). To get around this, I had to use the assembly qualified name.

Is there a simpler way to create a class reference when the class is in another assembly? Specifying the assembly name alone wouldn't be too bad but the other assembly information is more complex than I would like. I used Reflector to even get the full name.

Here is what worked:

<Mapping FromType='Inspection.Domain.Mapping.IEntityMapper`1[Domain.Data.Item, Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null], Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
ToType='Domain.Mapping.ItemMapper, Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' />

Thank you,

David Morris