diab0l edited this page Aug 12, 2014 · 6 revisions

Unity from Microsoft is supported via its fluent API of the UnityContainer instance.

Manual Registration

  • RegisterType<Foo>()
  • RegisterType<IFoo, Foo>()
  • RegisterType(typeof(Foo), ...)
  • RegisterType(typeof(IFoo), typeof(Foo), ...)

Chained registrations are also supported, i.e. container.RegisterType<Foo>().RegisterType<IBar, Bar>()

Not (yet?) supported

  • RegisterInstance<TInterface>(...) - ReSharper will not complain about the type being unused, since it must be instantiated.
  • RegisterInstance(typeof(TInterface), ...) - non generic version.
  • Resolve - is it true you can resolve any concrete type with Unity, even if you never registered it explicitly? (answer: Yes it is)