Exemplo n.º 1
0
        public override System.Linq.Expressions.Expression ToLinqExpression(IExpressionContext ctx)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException(nameof(ctx));
            }

            var vp = ctx.GetParameter("vp");
            var vs = ctx.GetParameter("vs");
            var mv = ctx.GetParameter("mv");
            var ts = ctx.GetParameter("ts");

            MethodInfo methodInfo;

            switch (FieldType)
            {
            case EntityFieldType.String:
                methodInfo = GetStringMemberInfo; break;

            case EntityFieldType.Int32:
                methodInfo = GetInt32MemberInfo; break;

            case EntityFieldType.Guid:
                methodInfo = GetGuidMemberInfo; break;

            case EntityFieldType.Byte:
                methodInfo = GetByteMemberInfo; break;

            default:
                throw ExceptionHelper.NotImplemented();
            }
            var id = System.Linq.Expressions.Expression.Constant(FieldId);

            return(System.Linq.Expressions.Expression.Call(methodInfo, id, vp, vs, mv, ts));
        }