private object GetInstance(IDependency dependency) { if (dependency.Instance == null || dependency.Scope == InstantiationScope.NonSingleton) { var parameters = ResolveConstructorParameters(dependency); dependency.CreateInstance(parameters.ToArray()); } return(dependency.Instance); }