Why are all types constructed on first use of Unity?

Sep 16, 2008 at 2:04 AM
We just started using Unity and I'm trying to figure out if this is normal behavior: It looks like on first use of the container, every type in the config file must be resolvable, or it will fail. Is there any way to not have this happen? For example, if my unity config has 100 types in it and I am running a post build unit test that uses just a couple of those types, the all types in the config must resolve for any of them to succeed. I guess I had assumed it would only require the actual types requested to resolve to be available.
Sep 16, 2008 at 7:52 PM
Objects are not constructed at config time, but the types are reflected over so that we can detect things like configuring constructors that don't exist. That requires that the type definitions be available.

You should just need the DLL's to be present and the .NET loader will do the rest.

Sep 16, 2008 at 8:20 PM
Good to know that distinction. Thanks.