Пример #1
0
        ICode Convert(MemberExpression member)
        {
            //sub.Body or sub.Name
            var bodyOrName = TryResolveSqlExpressionBodyOrName(member);

            if (bodyOrName != null)
            {
                return(bodyOrName);
            }

            //sql symbol.
            var symbolMember = member.GetMemberConverter();

            if (symbolMember != null)
            {
                //convert.
                return(symbolMember.Convert(member, this));
            }

            //sql symbol extension method
            var method = member.Expression as MethodCallExpression;

            if (method != null)
            {
                var symbolMethod = method.GetMethodConverter();
                if (symbolMethod != null)
                {
                    var ret = symbolMethod.Convert(method, this);
                    //T()
                    var tbl = ret as DbTableCode;
                    if (tbl != null)
                    {
                        var memberName = tbl.Info.LambdaFullName + "." + member.Member.Name;
                        return(ResolveLambdicElement(memberName));
                    }
                    else
                    {
                        return(new HCode(ret, new SingleTextCode("." + member.Member.Name)));
                    }
                }
            }

            //db element.
            ICode code;

            if (TryGetDbDesignParamCode(member, out code))
            {
                return(code);
            }

            //get value.
            return(ResolveExpressionObject(member));
        }