mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-20 15:55:25 +03:00
type discovery without attributes
This commit is contained in:
@@ -4,6 +4,7 @@ using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using ServiceStack.Api.Swagger;
|
||||
using ServiceStack.Common.Web;
|
||||
using ServiceStack.Configuration;
|
||||
using ServiceStack.Logging.NLogger;
|
||||
using ServiceStack.ServiceHost;
|
||||
using ServiceStack.ServiceInterface.Cors;
|
||||
@@ -153,6 +154,8 @@ namespace MediaBrowser.Common.Net
|
||||
DebugMode = true
|
||||
});
|
||||
}
|
||||
|
||||
container.Adapter = new ContainerAdapter(ApplicationHost);
|
||||
|
||||
container.Register(Kernel);
|
||||
container.Register(_logger);
|
||||
@@ -464,4 +467,23 @@ namespace MediaBrowser.Common.Net
|
||||
/// <value>The endpoint.</value>
|
||||
public IPEndPoint Endpoint { get; set; }
|
||||
}
|
||||
|
||||
class ContainerAdapter : IContainerAdapter
|
||||
{
|
||||
private readonly IApplicationHost _appHost;
|
||||
|
||||
public ContainerAdapter(IApplicationHost appHost)
|
||||
{
|
||||
_appHost = appHost;
|
||||
}
|
||||
public T Resolve<T>()
|
||||
{
|
||||
return _appHost.Resolve<T>();
|
||||
}
|
||||
|
||||
public T TryResolve<T>()
|
||||
{
|
||||
return _appHost.TryResolve<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user