public override string BuildListQuery(Guid productID) { StringBuilder sql = new StringBuilder(); //-- //string where = WhereClause.BuildExpression(ProductIDColumn, productID.ToString()); //-collect from and join values- Aspect.Model.Query.FieldsSQLBuilder propertyQuery = new Aspect.Model.ProductDomain.Query.PropertyFieldsSQLBuilder(Columns); Aspect.Model.Query.FieldsSQLBuilder dictionaryQuery = new Aspect.Model.ProductDomain.Query.DictionaryFieldsSQLBuilder(UserFields, Provider); StringBuilder join = new StringBuilder(); join.Append(propertyQuery.Join); join.Append(dictionaryQuery.Join); StringBuilder from = new StringBuilder(); from.Append(propertyQuery.From); from.Append(dictionaryQuery.From); sql.AppendFormat(SqlTemplate, from.ToString(), join.ToString(), productID.ToString()); return sql.ToString(); }
public override string BuildListQuery(Guid productID) { StringBuilder sql = new StringBuilder(); //-- //string where = WhereClause.BuildExpression(ProductIDColumn, productID.ToString()); //-collect from and join values- Aspect.Model.Query.FieldsSQLBuilder propertyQuery = new Aspect.Model.ProductDomain.Query.PropertyFieldsSQLBuilder(Columns); Aspect.Model.Query.FieldsSQLBuilder dictionaryQuery = new Aspect.Model.ProductDomain.Query.DictionaryFieldsSQLBuilder(UserFields, Provider); //-collect group by List<string> groupby = new List<string>() { "product.id", "_dictUM.umn1" }; groupby.AddRange(Columns.Select(c => string.Format(groupbytemplateProp, c.Alias)).ToList()); groupby.AddRange(UserFields.Select(us => string.Format(groupbytemplateDict, us.DictionaryTree.Alias, us.DictionaryProperty.ColumnName)).ToList()); /*Columns.ConvertAll( delegate(Property p) { return String.Format(groupbytemplateProp,p.Alias } );*/ //-- StringBuilder join = new StringBuilder(); join.Append(propertyQuery.Join); join.Append(dictionaryQuery.Join); StringBuilder from = new StringBuilder(); from.Append(propertyQuery.From); from.Append(dictionaryQuery.From); sql.AppendFormat(SqlTemplate, from.ToString(), join.ToString(), productID.ToString(), string.Join(",", groupby.ToArray()) //,where //,OrderExpression.OrderClause ); return sql.ToString(); }