Example #1
0
        private bool TryGetTable(MemberExpression me)
        {
            if (me == null)
            {
                this.fallback = true;
                return(false);
            }

            TableFindResult result = this.tableFinder.Find(me);

            if (result.MimeType != null)
            {
                this.queryBuilder.Append(String.Format("({0} = ?)", ContactsContract.DataColumns.Mimetype));
            }

            this.arguments.Add(result.MimeType);

            if (Table == null)
            {
                Table = result.Table;
            }
            else if (Table != result.Table)
            {
                this.fallback = true;
                return(false);
            }

            return(true);
        }
Example #2
0
            protected override Expression VisitMemberAccess(MemberExpression memberExpression)
            {
                TableFindResult result = this.tableFinder.Find(memberExpression);

                if (this.table == null)
                {
                    this.table = result;
                }
                else if (Table != result.Table || result.MimeType != this.table.MimeType)
                {
                    Fallback = true;
                    return(memberExpression);
                }

                ContentResolverColumnMapping cmap = this.tableFinder.GetColumn(memberExpression.Member);

                if (cmap == null || cmap.Columns == null)
                {
                    Fallback = true;
                    return(memberExpression);
                }

                this.currentMap = cmap;

                if (cmap.Columns.Length == 1)
                {
                    this.builder.Append(cmap.Columns[0]);
                }
                else
                {
                    throw new NotSupportedException();
                }

                return(base.VisitMemberAccess(memberExpression));
            }
        public TableFindResult Find(Expression expression)
        {
            Visit(expression);

            var result = new TableFindResult(this.table, this.mimeType);

            this.table    = null;
            this.mimeType = null;

            return(result);
        }
    public TableFindResult Find(Expression expression)
    {
      Visit(expression);

      var result = new TableFindResult(this.table, this.mimeType);

      this.table = null;
      this.mimeType = null;

      return result;
    }
Example #5
0
        private bool TryGetTable(List <MemberExpression> memberExpressions)
        {
            if (memberExpressions.Count == 0)
            {
                this.fallback = true;
                return(false);
            }

            Android.Net.Uri existingTable = Table;

            TableFindResult presult = null;

            foreach (MemberExpression me in memberExpressions)
            {
                TableFindResult result = this.tableFinder.Find(me);
                if (result.Table == null)
                {
                    this.fallback = true;
                    return(false);
                }

                if (existingTable == null)
                {
                    existingTable = result.Table;
                    presult       = result;
                }
                else if (existingTable != result.Table)
                {
                    this.fallback = true;
                    return(false);
                }
            }

            if (presult == null)
            {
                this.fallback = true;
                return(false);
            }

            Table = presult.Table;

            if (presult.MimeType != null)
            {
                if (this.queryBuilder.Length > 0)
                {
                    this.queryBuilder.Append(" AND ");
                }

                this.queryBuilder.Append(String.Format("({0} = ?)", ContactsContract.DataColumns.Mimetype));
            }
            this.arguments.Add(presult.MimeType);

            return(true);
        }
      protected override Expression VisitMemberAccess(MemberExpression memberExpression)
      {
        TableFindResult result = this.tableFinder.Find(memberExpression);
        if (this.table == null)
          this.table = result;
        else if (Table != result.Table || result.MimeType != this.table.MimeType)
        {
          Fallback = true;
          return memberExpression;
        }

        ContentResolverColumnMapping cmap = this.tableFinder.GetColumn(memberExpression.Member);
        if (cmap == null || cmap.Columns == null)
        {
          Fallback = true;
          return memberExpression;
        }

        this.currentMap = cmap;

        if (cmap.Columns.Length == 1)
          this.builder.Append(cmap.Columns[0]);
        else
          throw new NotSupportedException();

        return base.VisitMemberAccess(memberExpression);
      }