ContainerAdapter.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using MediaBrowser.Common;
  2. using ServiceStack.Configuration;
  3. namespace MediaBrowser.Server.Implementations.HttpServer
  4. {
  5. /// <summary>
  6. /// Class ContainerAdapter
  7. /// </summary>
  8. class ContainerAdapter : IContainerAdapter, IRelease
  9. {
  10. /// <summary>
  11. /// The _app host
  12. /// </summary>
  13. private readonly IApplicationHost _appHost;
  14. /// <summary>
  15. /// Initializes a new instance of the <see cref="ContainerAdapter" /> class.
  16. /// </summary>
  17. /// <param name="appHost">The app host.</param>
  18. public ContainerAdapter(IApplicationHost appHost)
  19. {
  20. _appHost = appHost;
  21. }
  22. /// <summary>
  23. /// Resolves this instance.
  24. /// </summary>
  25. /// <typeparam name="T"></typeparam>
  26. /// <returns>``0.</returns>
  27. public T Resolve<T>()
  28. {
  29. return _appHost.Resolve<T>();
  30. }
  31. /// <summary>
  32. /// Tries the resolve.
  33. /// </summary>
  34. /// <typeparam name="T"></typeparam>
  35. /// <returns>``0.</returns>
  36. public T TryResolve<T>()
  37. {
  38. return _appHost.TryResolve<T>();
  39. }
  40. /// <summary>
  41. /// Releases the specified instance.
  42. /// </summary>
  43. /// <param name="instance">The instance.</param>
  44. public void Release(object instance)
  45. {
  46. // Leave this empty so SS doesn't try to dispose our objects
  47. }
  48. }
  49. }