0

I have two closely related applications that are both using the Unity IoC container. They have some custom types in common, but not all of them. At the moment I have two config files that have a lot of duplication. I'd like to have just one Unity config file to rule them all.

However, as not all types exist in both applications Unity is unhappy. What I want is a way to tell Unity not to try and register/instantiate the types in the config file unless the container is asked for them.

I can think of a couple of solutions but as I'm a Unity newbie I don't want to guess/reinvent.

And yes, it must be Unity. For now.

No More Hacks
  • 299
  • 4
  • 14

1 Answers1

1

Have you tried something like an extension, have a look at,

Is there TryResolve in Unity?

and see if it help you out.

Community
  • 1
  • 1
Johan Leino
  • 3,473
  • 1
  • 26
  • 27
  • I think that this answers the question. Thanks! I'm still not sure if this is the right way to go. I did think about using a shared container for the common elements and a child container for the specifics, but then you have 3 files instead of 2! – No More Hacks Sep 01 '09 at 08:01