private void ProcessWhere(T state, StringBuilder builder, IAppendableExpr where)
 {
     if (where.Type != ExprType.EMPTY)
     {
         builder.Append(" WHERE ");
         where.Visit(state, builder, this);
     }
 }
Exemplo n.º 2
0
        private static IAppendableExpr ZipOn(IExpr[] outerKeys, IExpr[] innerKeys)
        {
            if (outerKeys.Length != innerKeys.Length)
            {
                throw new Exception("Inner and Outer key selectors must specify the same number of keys");
            }

            IAppendableExpr on = Expr.Empty;

            for (int n = 0; n < outerKeys.Length && n < innerKeys.Length; n++)
            {
                on = on.And(Expr.Eq(outerKeys[n], innerKeys[n]));
            }

            return(on);
        }
Exemplo n.º 3
0
        internal static IExpr IdentityExpr <T>(T value)
        {
            var reflection = StencilContext.ReflectionServices;

            if (reflection == null)
            {
                throw new MissingReflectionException();
            }
            var             metadata = EnsureMetadata(typeof(T));
            IAppendableExpr result   = Expr.Empty;

            foreach (var item in metadata.Keys)
            {
                var keyName  = (Variable)item.Key;
                var keyValue = new Literal(reflection.GetValue(item, value));
                result = result.And(Expr.Eq(keyName, keyValue));
            }
            return(result);
        }
Exemplo n.º 4
0
 public Delete WhereOr(string expr)
 {
     this.WhereExpr = this.WhereExpr.Or(Expr.Parse(expr));
     return(this);
 }
Exemplo n.º 5
0
 public Delete WhereOr(IExpr expr)
 {
     this.WhereExpr = this.WhereExpr.Or(expr);
     return(this);
 }
Exemplo n.º 6
0
 public Delete Where(IExpr expr)
 {
     this.WhereExpr = this.WhereExpr.And(expr);
     return(this);
 }