Using Funq in ServiceStack

  • How can I access an instance Containeroutside the controller?
  • I need to use Container.Resolvein my class, but how can I access the instance Container?
  • Is it a singleton?
  • Is it possible to use new Container()or is there any kind of chain, for example Funq.StaticContainer?

Thanks to Mythz for the hints of gist , a) or b) or c).

I use the Mythz solution, it is accepted by me, but there are problems for its ServiceLocatorPattern, you can check additional information here .

+5
source share
1 answer

AppHost. IAppHost :

HostContext.TryResolve<T>();
HostContext.Resolve<T>();
HostContext.AppHost.TryResolve<T>();

- Funq.Container, singleton:

ServiceStackHost.Instance.Container

, Razor .. :

base.TryResolve<T>();
+7

All Articles