Unity Register two interfaces as one singleton
Posted
by Christian
on Stack Overflow
See other posts from Stack Overflow
or by Christian
Published on 2009-09-08T15:26:38Z
Indexed on
2010/04/29
13:47 UTC
Read the original article
Hit count: 395
unity
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
© Stack Overflow or respective owner