Exemplo n.º 1
0
        protected virtual void OnProcessWheres(IParsedLambda lambda, SqlExpression expression)
        {
            var builder = WhereCriteriaBuilderFn();

            for (var i = 0; i < lambda.Nodes.Length; i++)
            {
                var node = lambda.Nodes[i];
                if (node is MemberNode)
                {
                    OnProcessWhereMemberNode(lambda, expression, builder, i, (MemberNode)node);
                }
                else if (node is OperatorNode)
                {
                    builder.AddOp((OperatorNode)node);
                }
                else if (node is ValueNode)
                {
                    builder.AddValue((ValueNode)node);
                }
                else if (node is NullNode)
                {
                    builder.AddNullValue((NullNode)node);
                }
                else
                {
                    builder.AddRaw(node.ToString());
                }

                builder.Flush();
            }

            var whereCriteria = builder.IsEmpty
                ? SqlWhereCriteria.Empty()
                : new SqlWhereCriteria(builder.Sql, builder.Params.ToArray());

            expression.SetWhereCriteria(whereCriteria);
        }
Exemplo n.º 2
0
        public virtual void SetWhereCriteria(SqlWhereCriteria whereCriteria)
        {
            Ensure.That(whereCriteria, "whereCriteria").IsNotNull();

            _whereCriteria = whereCriteria;
        }
        public virtual void SetWhereCriteria(SqlWhereCriteria whereCriteria)
        {
            Ensure.That(whereCriteria, "whereCriteria").IsNotNull();

            _whereCriteria = whereCriteria;
        }