private static void BindDependency(Type type, string dependencyName, string dependencyText, ParseContext parseContext)
 {
     var serviceConstructor = type.GetConstructor();
     if (!serviceConstructor.isOk)
     {
         var message = string.Format("type [{0}] has ", type.FormatName());
         throw new SimpleContainerException(message + serviceConstructor.errorMessage);
     }
     var formalParameter = serviceConstructor.value.GetParameters().SingleOrDefault(x => x.Name == dependencyName);
     if (formalParameter == null)
     {
         const string message = "type [{0}] has no dependency [{1}]";
         throw new SimpleContainerException(string.Format(message, type.FormatName(), dependencyName));
     }
     var targetType = formalParameter.ParameterType;
     var underlyingType = Nullable.GetUnderlyingType(targetType);
     if (underlyingType != null)
         targetType = underlyingType;
     IConvertible convertible = dependencyText;
     object parsedValue;
     try
     {
         parsedValue = convertible.ToType(targetType, CultureInfo.InvariantCulture);
     }
     catch (Exception e)
     {
         const string message = "can't parse [{0}.{1}] from [{2}] as [{3}]";
         throw new SimpleContainerException(string.Format(message, type.FormatName(), dependencyName,
             dependencyText, formalParameter.ParameterType.FormatName()), e);
     }
     parseContext.GetServiceBuilder(type).BindDependency(dependencyName, parsedValue);
 }