Exemple #1
0
        /// <summary>
        /// 生成指定加载选项的聚合SQL。
        /// </summary>
        /// <param name="loadOptions">The load options.</param>
        /// <param name="whereCondition">简单的过滤条件,如:
        /// PBS.PBSTypeId = '...'</param>
        /// <param name="joinCondition">The join condition.</param>
        /// <returns></returns>
        public string GenerateQuerySQL(LoadOptionSelector loadOptions, string whereCondition = null, string joinCondition = null)
        {
            var aggregateSQL = new AggregateSQLGenerator(loadOptions.InnerDescriptor, whereCondition, joinCondition);
            var result       = aggregateSQL.Generate();

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 生成指定加载选项的聚合SQL。
        ///
        /// 此方法使用父对象的Id作为查询条件。
        /// </summary>
        /// <param name="loadOptions"></param>
        /// <param name="parentId"></param>
        /// <returns></returns>
        public string GenerateQuerySQL(LoadOptionSelector loadOptions, object parentId)
        {
            var aggregateSQL = new AggregateSQLGenerator(loadOptions.InnerDescriptor, null);
            var result       = aggregateSQL.Generate();

            result = string.Format(result, parentId);
            return(result);
        }
Exemple #3
0
        /// <summary>
        /// 通过聚合SQL加载整个聚合对象列表。
        /// </summary>
        /// <param name="list">The list.</param>
        /// <param name="sql">聚合SQL</param>
        /// <param name="loadOptions">聚合加载选项</param>
        public void LoadEntities(EntityList list, string sql, LoadOptionSelector loadOptions)
        {
            var loader = new AggregateEntityLoader(loadOptions.InnerDescriptor);

            loader.Query(list, sql);
        }