Exemple #1
0
        public string BuildEntityQuery(Guid ID, Guid treeNodeID)
        {
            StringBuilder sql = new StringBuilder();
            //-collect from and join values-
            Aspect.Model.Query.FieldsSQLBuilder dictionaryQuery = new DictionaryFieldsSQLBuilder(UserFields, Provider, treeNodeID);

            StringBuilder join = new StringBuilder();
            join.Append(dictionaryQuery.Join);

            StringBuilder from = new StringBuilder();
            from.Append(dictionaryQuery.From);
            //
            Aspect.Domain.DictionaryTree entity = Provider.DictionaryTrees.Single(d => d.ID == treeNodeID);
            //item.Dictionary.TableName

            string where = WhereClause.BuildExpression(string.Format("[{0}].[{1}]", entity.Alias, entity.PK), ID.ToString());
            //
            sql.AppendFormat(SqlTemplate,
                from.ToString(),
                join.ToString(),
                where,
                string.Empty,
                entity.Dictionary.TableName,
                entity.PK,
                entity.Alias);
            return sql.ToString();
        }
Exemple #2
0
        public string BuildListQuery(Guid treeNodeID)
        {
            StringBuilder sql = new StringBuilder();
            //--
            string where = WhereClause.BuildExpression(SearchSource.Convert(this.SearchExpression));

            //-collect from and join values-
            Aspect.Model.Query.FieldsSQLBuilder dictionaryQuery = new DictionaryFieldsSQLBuilder(UserFields, Provider, treeNodeID);

            StringBuilder join = new StringBuilder();
            join.Append(dictionaryQuery.Join);

            StringBuilder from = new StringBuilder();
            from.Append(dictionaryQuery.From);

            Aspect.Domain.DictionaryTree entity = Provider.DictionaryTrees.Single(d => d.ID == treeNodeID);

            sql.AppendFormat(SqlTemplate,
                from.ToString(),
                join.ToString(),
                where,
                OrderExpression.OrderClause,
                entity.Dictionary.TableName,
                entity.PK,
                entity.Alias);
            return sql.ToString();
        }