internal static string Build(TablePaginationToken token, TableQueryOptions options)
        {
            if (token == null && options == null)
            {
                return(null);
            }

            var result = Quote;

            if (token != null)
            {
                result += "NextPartitionKey=" + Uri.EscapeDataString(token.NextPartitionKey) + "&NextRowKey=" + Uri.EscapeDataString(token.NextRowKey);
            }

            if (options == null)
            {
                return(result);
            }

            if (options.Top > 0)
            {
                result  = Result(result);
                result += "$top=" + options.Top.ToString(CultureInfo.InvariantCulture);
            }

            if (!string.IsNullOrEmpty(options.SelectProperties))
            {
                result  = Result(result);
                result += "$select=" + options.SelectProperties;
            }

            if (options.Filters?.Length > 0)
            {
                result  = Result(result);
                result += "$filter=" + BuildFilterCondition(options.Filters);
            }

            string Result(string s)
            {
                if (s.IndexOf('?') == -1)
                {
                    s += Quote;
                }
                else if (s == "?")
                {
                    return(s);
                }
                else
                {
                    s += "&";
                }
                return(s);
            }

            return(result);
        }
Пример #2
0
 internal static TableOperation Get(ITableEntity entity, TableQueryOptions options = null, TablePaginationToken token = null) => new TableOperation(entity, TableOperationType.Get, token, options);
Пример #3
0
 public Task <TableQueryResult <T> > QueryAsync <T>(ITableEntity entity, TablePaginationToken token, TableQueryOptions options) where T : class
 {
     return(TableOperation.Get(entity, options, token).ExecuteQueryAsync <T>(_credentials, _tableStorageUri));
 }
Пример #4
0
        internal TableOperation(ITableEntity entity, TableOperationType operationType, TablePaginationToken token, TableQueryOptions options)
        {
            _entity = entity;

            _operationType = operationType;

            _tableUri = new TableUri(entity, operationType, TableUriQueryBuilder.Build(token, options));

            if (operationType == TableOperationType.InsertEdmType)
            {
                _edmTypeEntity = EntityPropertyBuilder.Build(entity);
            }
        }