public override string GetOrderString(DataEntityMapping mapping, OrderExpression order, out DataParameter[] parameters, Dictionary <string, DataFieldInfo> dataFieldInfoDictionary, Dictionary <string, AggregateFunction> aggregateFunctionDictionary)
        {
            string orderString = null;

            parameters = null;
            if (order != null)
            {
                if (order.IgnoreConsistency)
                {
                    RandomOrderExpression random = order as RandomOrderExpression;
                    if (random != null)
                    {
                        random.SetTableMapping(mapping);
                    }
                }
                if (!order.IgnoreConsistency && !mapping.Equals(order.TableMapping))
                {
                    throw new LightDataException(RE.DataMappingIsNotMatchOrderExpression);
                }
                orderString = string.Format("order by {0}", order.CreateSqlString(this, out parameters, new GetAliasHandler(delegate(object obj) {
                    return(null);
                })));
            }
            return(orderString);
        }
        public virtual string GetOrderString(DataEntityMapping mapping, OrderExpression order, out DataParameter[] parameters, Dictionary <string, DataFieldInfo> dataFieldInfoDictionary, Dictionary <string, AggregateFunction> aggregateFunctionDictionary)
        {
            string orderString = null;

            parameters = null;
            if (order != null)
            {
                if (order.IgnoreConsistency)
                {
                    RandomOrderExpression random = order as RandomOrderExpression;
                    if (random != null)
                    {
                        random.SetTableMapping(mapping);
                    }
                }
                if (!order.IgnoreConsistency && !mapping.Equals(order.TableMapping))
                {
                    throw new LightDataException(RE.DataMappingIsNotMatchOrderExpression);
                }
                orderString = string.Format("order by {0}", order.CreateSqlString(this, out parameters, new GetAliasHandler(delegate(object obj) {
                    string alias = null;
                    if (obj is DataFieldInfo)
                    {
                        foreach (KeyValuePair <string, DataFieldInfo> kv in dataFieldInfoDictionary)
                        {
                            if (Object.ReferenceEquals(obj, kv.Value))
                            {
                                alias = kv.Key;
                                break;
                            }
                        }
                    }
                    else if (obj is AggregateFunction)
                    {
                        foreach (KeyValuePair <string, AggregateFunction> kv in aggregateFunctionDictionary)
                        {
                            if (Object.ReferenceEquals(obj, kv.Value))
                            {
                                alias = kv.Key;
                                break;
                            }
                        }
                    }
                    else
                    {
                        throw new LightDataException(RE.UnknowOrderType);
                    }
                    return(alias);
                })));
            }
            return(orderString);
        }
        public virtual string GetOrderString(DataEntityMapping mapping, OrderExpression order)
        {
            string orderString = null;

            DataParameter[] parameters = null;
            if (order != null)
            {
                if (order.IgnoreConsistency)
                {
                    RandomOrderExpression random = order as RandomOrderExpression;
                    if (random != null)
                    {
                        random.SetTableMapping(mapping);
                    }
                }
                if (!order.IgnoreConsistency && !mapping.Equals(order.TableMapping))
                {
                    throw new LightDataException(RE.DataMappingIsNotMatchOrderExpression);
                }
                orderString = string.Format("order by {0}", order.CreateSqlString(this, out parameters));
            }
            return(orderString);
        }