/// <summary>
 /// Resolve a component, optionally registering it in the container if <see cref="AutoRegisterDependencies"/> is set to <c>true</c>.
 /// </summary>
 /// <param name="dependencyType"></param>
 /// <returns></returns>
 public static object GetService(Type dependencyType)
 {
     if (dependencyType == null)
     {
         return(null);
     }
     if (Current == null)
     {
         throw new DependencyResolutionException("Cannot resolve services when no _resolver has been configured.");
     }
     if (AutoRegisterDependencies && !dependencyType.IsAbstract)
     {
         if (!Current.HasDependency(dependencyType))
         {
             Current.AddDependency(dependencyType, DependencyLifetime.Transient);
         }
     }
     return(Current.Resolve(dependencyType));
 }