Unity Register two interfaces as one singleton
- by Christian
Hi all,
how do I register two different interfaces in Unity with the same instance...
Currently I am using
_container.RegisterType<EventService, EventService>(new ContainerControlledLifetimeManager());
_container.RegisterInstance<IEventService>(_container.Resolve<EventService>());
_container.RegisterInstance<IEventServiceInformation>(_container.Resolve<EventService>());
which works, but does not look nice..
So, I think you get the idea. EventService implements two interfaces, I want a reference to the same object if I resolve the interfaces.
Chris