Exemplo n.º 1
0
 /// <summary>
 /// Converts the given string value to the type of the given property.
 /// </summary>
 /// <param name="value">The string value to be converted.</param>
 /// <param name="property">The property used to determine what type to convert to.</param>
 /// <returns>The given string converted to the type of the given property.</returns>
 protected virtual object ConvertToPropertyType(string value, ConnectionStringProperty property)
 {
     return(((object)property.Converter != null)
         ? property.Converter.ConvertFromString(value)
         : value.ConvertToType <object>(property.PropertyInfo.PropertyType));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Converts the given string value to the type of the given property.
 /// </summary>
 /// <param name="value">The string value to be converted.</param>
 /// <param name="property">The property used to determine what type to convert to.</param>
 /// <returns>The given string converted to the type of the given property.</returns>
 protected virtual object ConvertToPropertyType(string value, ConnectionStringProperty property)
 {
     return ((object)property.Converter != null)
         ? property.Converter.ConvertFromString(value)
         : value.ConvertToType<object>(property.PropertyInfo.PropertyType);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Converts the given object to a string.
 /// </summary>
 /// <param name="obj">The object to be converted.</param>
 /// <param name="property">The property which defines the type of the object.</param>
 /// <returns>The object converted to a string.</returns>
 protected virtual string ConvertToString(object obj, ConnectionStringProperty property)
 {
     return ((object)property.Converter != null)
         ? property.Converter.ConvertToString(obj)
         : Common.TypeConvertToString(obj);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Converts the given object to a string.
 /// </summary>
 /// <param name="obj">The object to be converted.</param>
 /// <param name="property">The property which defines the type of the object.</param>
 /// <returns>The object converted to a string.</returns>
 protected virtual string ConvertToString(object obj, ConnectionStringProperty property)
 {
     return(((object)property.Converter != null)
         ? property.Converter.ConvertToString(obj)
         : Common.TypeConvertToString(obj));
 }