private static void AddParameters(object value, TypeMapping typeMapping, BaseQueryBuilder baseQueryBuilder) { bool first = true; foreach (var property in typeMapping.Columns.Values) { if (property.Readonly) { continue; } if (first) { first = false; } else { baseQueryBuilder.StringBuilder.Append(","); } var propertyValue = value != null?property.PropertyInfo.GetValue(value) : null; if (property.Reference != null && property.Reference.IsComplexType) { AddParameters(propertyValue, property.Reference, baseQueryBuilder); } else { if (property.IsJson) { propertyValue = JsonConvert.SerializeObject(propertyValue); } var parameterIndex = baseQueryBuilder.AddParameter(propertyValue); baseQueryBuilder.StringBuilder.DuringParameter(parameterIndex); } } }
private static void AddParameters <T, TMe>(ISetTarget <T, TMe> target, object value, TypeMapping typeMapping, SelectedTable table, BaseQueryBuilder baseQueryBuilder, string baseName) { foreach (var property in typeMapping.Columns.Values) { if (property.Readonly) { continue; } var parameter = value != null?property.PropertyInfo.GetValue(value) : null; if (property.Reference != null && property.Reference.IsComplexType) { AddParameters(target, parameter, property.Reference, table, baseQueryBuilder, property.ComposeName(baseName)); } else { if (property.IsJson) { parameter = JsonConvert.SerializeObject(parameter); } target.AppendSet(); string tableName = table.Alias; baseQueryBuilder.StringBuilder.DuringColumn(tableName, property.ComposeName(baseName)); baseQueryBuilder.StringBuilder.Append("="); var index = baseQueryBuilder.AddParameter(parameter); baseQueryBuilder.StringBuilder.DuringParameter(index); } } }