Exemplo n.º 1
0
        protected virtual StatementPart VisitColumnMemberAccess(MemberExpression memberExpression)
        {
            if (memberExpression.Member.DeclaringType == typeof(string) &&
                memberExpression.Member.Name == "Length")
            {
                return(new StatementPart(
                           DialectProvider.GetStringFunction("length",
                                                             _statement,
                                                             null,
                                                             null)));
            }

            if (memberExpression.Member.DeclaringType == typeof(DateTime))
            {
                switch (memberExpression.Member.Name)
                {
                case "Year":
                case "Month":
                case "Day":
                case "Hour":
                case "Minute":
                case "Second":
                    return(new StatementPart(
                               DialectProvider.GetDatePartFunction(memberExpression.Member.Name, _statement)));

                default:
                    throw new NotSupportedException();
                }
            }

            return(null);
        }