diff options
| author | BaronGreenback <jimcartlidge@yahoo.co.uk> | 2020-07-17 12:51:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-17 12:51:55 +0100 |
| commit | 31ffd00dbd547c42db93df07ab9b1c87034bab13 (patch) | |
| tree | 92af1d276e95ac2ac9536addab882c1ae3a196d2 | |
| parent | 70c638d1d48178bc1458fe86a48b2b60b06b7171 (diff) | |
Update ApplicationHost.cs
| -rw-r--r-- | Emby.Server.Implementations/ApplicationHost.cs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 4d99bd759..8d213ac57 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -354,42 +354,6 @@ namespace Emby.Server.Implementations /// <summary> /// Creates an instance of type and resolves all constructor dependencies. /// </summary> - /// <param name="type">The type.</param> - /// <param name="parameter">Additional argument for the constructor.</param> - /// <returns></returns> - 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 <parameter> 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); - } - - /// <summary> - /// Creates an instance of type and resolves all constructor dependencies. - /// </summary> /// /// <typeparam name="T">The type.</typeparam> /// <returns>T.</returns> public T CreateInstance<T>() |
