From 31ffd00dbd547c42db93df07ab9b1c87034bab13 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Fri, 17 Jul 2020 12:51:55 +0100 Subject: [PATCH] Update ApplicationHost.cs --- .../ApplicationHost.cs | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 4d99bd759d..8d213ac57d 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -351,42 +351,6 @@ namespace Emby.Server.Implementations public object CreateInstance(Type type) => ActivatorUtilities.CreateInstance(ServiceProvider, type); - /// - /// Creates an instance of type and resolves all constructor dependencies. - /// - /// The type. - /// Additional argument for the constructor. - /// - public object CreateInstance(Type type, object parameter) - { - ConstructorInfo constructor = type.GetConstructors()[0]; - if (constructor != null) - { - ParameterInfo[] argInfo = constructor - .GetParameters(); - - object[] args = argInfo - .Select(o => o.ParameterType) - .Select(o => ServiceProvider.GetService(o)) - .ToArray(); - - if (parameter != null) - { - // Assumption is that the is always the last in the constructor's parameter list. - int argsLen = args.Length; - var argType = argInfo[argsLen - 1].ParameterType; - var paramType = parameter.GetType(); - if (argType.IsAssignableFrom(paramType) || argType == paramType) - { - args[argsLen - 1] = parameter; - return ActivatorUtilities.CreateInstance(ServiceProvider, type, args); - } - } - } - - return ActivatorUtilities.CreateInstance(ServiceProvider, type); - } - /// /// Creates an instance of type and resolves all constructor dependencies. ///