static ICode ConvertSelectedElement(ExpressionConverter converter, ObjectCreateMemberInfo element)
        {
            //single select.
            //for example, COUNT(*).
            if (string.IsNullOrEmpty(element.Name)) return converter.ConvertToCode(element.Expression);

            //normal select.
            return LineSpace(converter.ConvertToCode(element.Expression), "AS".ToCode(), element.Name.ToCode());
        }
        internal static ObjectCreateInfo MakeSelectInfo(Expression exp)
        {
            var select = new List<ObjectCreateMemberInfo>();
            var newExp = exp as NewExpression;
            if (newExp != null)
            {
                for (int i = 0; i < newExp.Arguments.Count; i++)
                {
                    var propInfo = newExp.Members[i] as PropertyInfo;
                    string name = null;
                    if (propInfo != null)
                    {
                        name = propInfo.Name;
                    }
                    else
                    {
                        //.net3.5
                        var method = newExp.Members[i] as MethodInfo;
                        name = method.GetPropertyName();
                    }
                    select.Add(new ObjectCreateMemberInfo(name, newExp.Arguments[i]));
                }
                return new ObjectCreateInfo(select, exp);
            }

            var initExp = exp as MemberInitExpression;
            if (initExp != null)
            {
                var elements = new ObjectCreateMemberInfo[initExp.Bindings.Count];
                for (int i = 0; i < elements.Length; i++)
                {
                    var e = initExp.Bindings[i] as MemberAssignment;
                    elements[i] = new ObjectCreateMemberInfo(e.Member.Name, e.Expression);
                }
                return new ObjectCreateInfo(elements, exp);
            }

            var member = exp as MemberExpression;
            if (member != null)
            {
                if (SupportedTypeSpec.IsSupported(exp.Type))
                {
                    return new ObjectCreateInfo(new[] { new ObjectCreateMemberInfo(string.Empty, exp) }, exp);
                }
                Type type = null;
                var prop = member.Member as PropertyInfo;
                if (prop != null) type = prop.PropertyType;
                else type = ((FieldInfo)member.Member).FieldType;
                return MakeSelectInfo(type);
            }

            return new ObjectCreateInfo(new[] { new ObjectCreateMemberInfo(string.Empty, exp )}, exp);
        }
        static ICode ConvertSelectedElement(ExpressionConverter converter, ObjectCreateMemberInfo element)
        {
            //single select.
            //for example, COUNT(*).
            if (string.IsNullOrEmpty(element.Name))
            {
                return(converter.ConvertToCode(element.Expression));
            }

            //normal select.
            var exp = converter.ConvertToCode(element.Expression);

            return(exp.IsEmpty ? exp : LineSpace(exp, AsClause, element.Name.ToCode()));
        }