private static void FillPamaterInjectionList(ParameterInfo[] parameterInfo, object[] parameters, IReadOnlyDependencyContainer container)
 {
     // Resolve the dependencies for the method parameters
     for (int i = 0; i < parameterInfo.Length; ++i)
     {
         ParameterInfo p             = parameterInfo[i];
         Type          parameterType = p.ParameterType;
         parameters[i] =
             container.BindingExists(parameterType) ?
             container.GetBinding(parameterType).GetInstance() :
             (parameterType.GetTypeInfo().IsValueType ? Activator.CreateInstance(parameterType, true) : null);
     }
 }
        /// <summary>
        /// Resolve all injectable properties across the type-chain.
        /// </summary>
        /// <param name="objToInject">The object for which to inject its properties.</param>
        /// <param name="currentType">The current type across the type chain.</param>
        /// <param name="container">The resource container.</param>
        /// <param name="injectionId">An identifier to restrict to specifically defined scopes.</param>
        private static void ResolvePropertyDependencies(object objToInject, Type currentType, IReadOnlyDependencyContainer container, string injectionId = null)
        {
            if (TryGetTypeInjectionInfo(currentType, out TypeInjectionCache cache))
            {
                bool isStaticInjection = objToInject is Type;

                foreach (MemberInjectionValue <PropertyInfo> property in cache.InjectableProperties)
                {
                    Type propertyType = property.Member.PropertyType;
                    if (property.Attribute.IsInjectionIdDefined(injectionId) && container.BindingExists(propertyType))
                    {
                        if (isStaticInjection && property.Member.SetMethod.IsStatic)
                        {
                            property.Member.SetValue(null, container.GetBinding(propertyType).GetInstance());
                        }
                        else if (!isStaticInjection && !property.Member.SetMethod.IsStatic)
                        {
                            property.Member.SetValue(objToInject, container.GetBinding(propertyType).GetInstance());
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Resolve all injectable fields across the type-chain.
        /// </summary>
        /// <param name="objToInject">The object for which to inject its fields.</param>
        /// <param name="currentType">The current type across the type chain.</param>
        /// <param name="container">The resource container.</param>
        /// <param name="injectionId">An identifier to restrict to specifically defined scopes.</param>
        private static void ResolveFieldDependencies(object objToInject, Type currentType, IReadOnlyDependencyContainer container, string injectionId = null)
        {
            if (TryGetTypeInjectionInfo(currentType, out TypeInjectionCache cache))
            {
                bool isStaticInjection = objToInject is Type;

                foreach (MemberInjectionValue <FieldInfo> field in cache.InjectableFields)
                {
                    Type fieldType = field.Member.FieldType;
                    if (field.Attribute.IsInjectionIdDefined(injectionId) && container.BindingExists(fieldType))
                    {
                        if (isStaticInjection && field.Member.IsStatic)
                        {
                            field.Member.SetValue(null, container.GetBinding(fieldType).GetInstance());
                        }
                        else if (!isStaticInjection && !field.Member.IsStatic)
                        {
                            field.Member.SetValue(objToInject, container.GetBinding(fieldType).GetInstance());
                        }
                    }
                }
            }
        }