mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-08 18:54:26 -04:00
Check for implementation of IService correctly
This commit is contained in:
parent
6f8c81ff7e
commit
b8580e58aa
@ -8,12 +8,17 @@ using Microsoft.Extensions.Logging;
|
|||||||
namespace Emby.Server.Implementations.Services
|
namespace Emby.Server.Implementations.Services
|
||||||
{
|
{
|
||||||
public delegate object ActionInvokerFn(object intance, object request);
|
public delegate object ActionInvokerFn(object intance, object request);
|
||||||
|
|
||||||
public delegate void VoidActionInvokerFn(object intance, object request);
|
public delegate void VoidActionInvokerFn(object intance, object request);
|
||||||
|
|
||||||
public class ServiceController
|
public class ServiceController
|
||||||
{
|
{
|
||||||
private readonly ILogger _log;
|
private readonly ILogger _log;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ServiceController"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="log">The <see cref="ServiceController"/> logger.</param>
|
||||||
public ServiceController(ILogger<ServiceController> log)
|
public ServiceController(ILogger<ServiceController> log)
|
||||||
{
|
{
|
||||||
_log = log;
|
_log = log;
|
||||||
@ -30,7 +35,7 @@ namespace Emby.Server.Implementations.Services
|
|||||||
public void RegisterService(HttpListenerHost appHost, Type serviceType)
|
public void RegisterService(HttpListenerHost appHost, Type serviceType)
|
||||||
{
|
{
|
||||||
// Make sure the provided type implements IService
|
// Make sure the provided type implements IService
|
||||||
if (!serviceType.IsAssignableFrom(typeof(IService)))
|
if (!typeof(IService).IsAssignableFrom(serviceType))
|
||||||
{
|
{
|
||||||
_log.LogWarning("Tried to register a service that does not implement IService: {ServiceType}", serviceType);
|
_log.LogWarning("Tried to register a service that does not implement IService: {ServiceType}", serviceType);
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user