Ejemplo n.º 1
0
        private SimpleQuery ParseWith(InvokeMemberBinder binder, object[] args)
        {
            if (args.Length > 0)
            {
                if (binder.Name.Equals("with", StringComparison.OrdinalIgnoreCase))
                {
                    return(With(args));
                }

                if (binder.Name.Equals("withone", StringComparison.OrdinalIgnoreCase))
                {
                    return(With(args, WithType.One));
                }

                if (binder.Name.Equals("withmany", StringComparison.OrdinalIgnoreCase))
                {
                    return(With(args, WithType.Many));
                }

                throw new ArgumentException("WithTable form does not accept parameters");
            }

            var objectName = binder.Name.Substring(4);

            if (string.IsNullOrWhiteSpace(objectName))
            {
                throw new ArgumentException("With requires a Table reference");
            }
            var withClause = new WithClause(new ObjectReference(objectName, new ObjectReference(_tableName, _dataStrategy), _dataStrategy));

            return(new SimpleQuery(this, _clauses.Append(withClause)));
        }
Ejemplo n.º 2
0
        private SimpleQuery ParseWith(InvokeMemberBinder binder, object[] args)
        {
            if (args.Length > 0)
            {
                if (binder.Name.Equals("with", StringComparison.OrdinalIgnoreCase))
                {
                    return(With(args));
                }

                if (binder.Name.Equals("withone", StringComparison.OrdinalIgnoreCase))
                {
                    return(With(args, WithType.One));
                }

                if (binder.Name.Equals("withmany", StringComparison.OrdinalIgnoreCase))
                {
                    return(With(args, WithType.Many));
                }
            }

            var objectName = binder.Name.Substring(4);
            var withClause = new WithClause(new ObjectReference(objectName, new ObjectReference(_tableName, _dataStrategy), _dataStrategy));

            return(new SimpleQuery(this, _clauses.Append(withClause)));
        }