Example #1
0
        private static void BuildValues(IList <PropertyInfo> props, object vacancy, string typeIdProperty, StringBuilder sqlBuilder)
        {
            for (var i = 0; i < props.Count; i++)
            {
                var prop = props[i];

                var propValue = prop.GetValue(vacancy, null);

                var name = prop.Name;

                if (name != typeIdProperty)
                {
                    if (propValue == null)
                    {
                        sqlBuilder.Append("NULL");
                    }
                    else
                    {
                        var formattedValue = InstanceFormatter.FormatTypeInstance(propValue, prop.PropertyType);
                        sqlBuilder.Append(formattedValue);
                    }
                    sqlBuilder.Append(i != props.Count - 1 ? ", " : ")");
                }
                else
                {
                    sqlBuilder.Append(i != props.Count - 1 ? "" : ")");
                }
            }
        }
Example #2
0
 public string Format(object value)
 {
     return(InstanceFormatter.FormatTypeInstance(value, value.GetType()));
 }