public virtual ServiceStats GetServiceStats(TableRequestOptions requestOptions = null, OperationContext operationContext = null) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = operationContext ?? new OperationContext(); return(Executor.ExecuteSync( this.GetServiceStatsImpl(requestOptions), requestOptions.RetryPolicy, operationContext)); }
internal static TableRequestOptions ApplyDefaultsAndClearEncryption(TableRequestOptions requestOptions, CloudTableClient serviceClient) { TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, serviceClient); modifiedOptions.RequireEncryption = false; modifiedOptions.EncryptionPolicy = null; modifiedOptions.EncryptionResolver = null; return(modifiedOptions); }
internal static TableRequestOptions ApplyDefaultsAndClearEncryption(TableRequestOptions requestOptions, CloudTableClient serviceClient) { TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, serviceClient); #if !(WINDOWS_RT || NETCORE) modifiedOptions.ClearEncryption(); #endif return(modifiedOptions); }
internal TableResult Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext) { TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = operationContext ?? new OperationContext(); CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); return(Executor.ExecuteSync(this.GenerateCMDForOperation(client, table, modifiedOptions), modifiedOptions.RetryPolicy, operationContext)); }
public virtual ICancellableAsyncResult BeginGetServiceStats(TableRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = operationContext ?? new OperationContext(); return(Executor.BeginExecuteAsync( this.GetServiceStatsImpl(requestOptions), requestOptions.RetryPolicy, operationContext, callback, state)); }
internal TableQuerySegment <TElement> ExecuteQuerySegmentedInternal(TableContinuationToken token, CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext) { CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = operationContext ?? new OperationContext(); RESTCommand <TableQuerySegment <TElement> > cmdToExecute = QueryImpl(this, token, client, table, EntityUtilities.ResolveEntityByType <TElement>, modifiedOptions); return(Executor.ExecuteSync(cmdToExecute, modifiedOptions.RetryPolicy, operationContext)); }
internal ICancellableAsyncResult BeginExecuteQuerySegmentedInternal(TableContinuationToken token, CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state) { CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = operationContext ?? new OperationContext(); return(Executor.BeginExecuteAsync( QueryImpl(this, token, client, table, EntityUtilities.ResolveEntityByType <TElement>, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, callback, state)); }
internal ICancellableAsyncResult BeginExecute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state) { TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = operationContext ?? new OperationContext(); CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); return(Executor.BeginExecuteAsync( this.GenerateCMDForOperation(client, table, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, callback, state)); }
internal IList <TableResult> Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext) { TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = operationContext ?? new OperationContext(); CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); if (this.operations.Count == 0) { throw new InvalidOperationException(SR.EmptyBatchOperation); } if (this.operations.Count > 100) { throw new InvalidOperationException(SR.BatchExceededMaximumNumberOfOperations); } return(Executor.ExecuteSync(BatchImpl(this, client, table, modifiedOptions), modifiedOptions.RetryPolicy, operationContext)); }
internal IEnumerable <TResult> Execute <TResult>(CloudTableClient client, CloudTable table, EntityResolver <TResult> resolver, TableRequestOptions requestOptions, OperationContext operationContext) { CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = operationContext ?? new OperationContext(); IEnumerable <TResult> enumerable = CommonUtility.LazyEnumerable <TResult>( (continuationToken) => { TableQuerySegment <TResult> seg = this.ExecuteQuerySegmented((TableContinuationToken)continuationToken, client, table, resolver, modifiedOptions, operationContext); return(new ResultSegment <TResult>(seg.Results) { ContinuationToken = seg.ContinuationToken }); }, this.takeCount.HasValue ? this.takeCount.Value : long.MaxValue); return(enumerable); }
public virtual void SetServiceProperties(ServiceProperties properties, TableRequestOptions requestOptions = null, OperationContext operationContext = null) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = operationContext ?? new OperationContext(); Executor.ExecuteSync(this.SetServicePropertiesImpl(properties, requestOptions), requestOptions.RetryPolicy, operationContext); }
internal ExecutionInfo Bind() { ExecutionInfo retVal = new ExecutionInfo(); // IQueryable impl if (this.Expression != null) { Dictionary <Expression, Expression> normalizerRewrites = new Dictionary <Expression, Expression>(ReferenceEqualityComparer <Expression> .Instance); // Step 1. Evaluate any local evaluatable expressions ( lambdas etc) Expression partialEvaluatedExpression = Evaluator.PartialEval(this.Expression); // Step 2. Normalize expression, replace String Comparisons etc. Expression normalizedExpression = ExpressionNormalizer.Normalize(partialEvaluatedExpression, normalizerRewrites); // Step 3. Bind Expression, Analyze predicates and create query option expressions. End result is a single ResourceSetExpression Expression boundExpression = ResourceBinder.Bind(normalizedExpression); // Step 4. Parse the Bound expression into sub components, i.e. take count, filter, select columns, request options, opcontext, etc. ExpressionParser parser = new ExpressionParser(); parser.Translate(boundExpression); // Step 5. Store query components & params this.TakeCount = parser.TakeCount; this.FilterString = parser.FilterString; this.SelectColumns = parser.SelectColumns; retVal.RequestOptions = parser.RequestOptions; retVal.OperationContext = parser.OperationContext; // Step 6. If projection & no resolver then generate a resolver to perform the projection if (parser.Resolver == null) { if (parser.Projection != null && parser.Projection.Selector != ProjectionQueryOptionExpression.DefaultLambda) { Type intermediateType = parser.Projection.Selector.Parameters[0].Type; // Convert Expression to take type object as input to allow for direct invocation. ParameterExpression paramExpr = Expression.Parameter(typeof(object)); Func <object, TElement> projectorFunc = Expression.Lambda <Func <object, TElement> >( Expression.Invoke(parser.Projection.Selector, Expression.Convert(paramExpr, intermediateType)), paramExpr).Compile(); // Generate a resolver to do the projection. retVal.Resolver = (pk, rk, ts, props, etag) => { // Parse to intermediate type ITableEntity intermediateObject = (ITableEntity)EntityUtilities.InstantiateEntityFromType(intermediateType); intermediateObject.PartitionKey = pk; intermediateObject.RowKey = rk; intermediateObject.Timestamp = ts; intermediateObject.ReadEntity(props, parser.OperationContext); intermediateObject.ETag = etag; // Invoke lambda expression return(projectorFunc(intermediateObject)); }; } else { // No op - No resolver or projection specified. } } else { retVal.Resolver = (EntityResolver <TElement>)parser.Resolver.Value; } } retVal.RequestOptions = TableRequestOptions.ApplyDefaults(retVal.RequestOptions, this.queryProvider.Table.ServiceClient); retVal.OperationContext = retVal.OperationContext ?? new OperationContext(); return(retVal); }