private TableResult GetTableResultFromDocument(TableOperation operation, Document response, OperationContext context) { TableResult result = new TableResult(); result.Etag = response.ETag; result.HttpStatusCode = GetSuccessStatusCodeFromOperationType(operation.OperationType); if (operation.OperationType != TableOperationType.Retrieve) { operation.Entity.ETag = response.ETag; result.Result = operation.Entity; } else { if (operation.RetrieveResolver != null) { result.Result = operation.RetrieveResolver(response.GetPropertyValue <string>(StellarConstants.PartitionKeyPropertyName), response.Id, response.Timestamp, EntityHelpers.GetEntityFromDocument(response, context).WriteEntity(context), response.ETag); } else { result.Result = EntityHelpers.GetEntityFromDocument(response, context); } } return(result); }
private TableResult GetTableResultFromResponse(TableOperation operation, ResourceResponse <Document> response, OperationContext context, TableRequestOptions options) { TableResult result = new TableResult(); result.Etag = response.ResponseHeaders["ETag"]; result.HttpStatusCode = (int)response.StatusCode; if (operation.OperationType != TableOperationType.Retrieve) { if (operation.OperationType != TableOperationType.Delete) { result.Result = operation.Entity; ITableEntity tableEntity = result.Result as ITableEntity; if (tableEntity != null) { tableEntity.ETag = result.Etag; tableEntity.Timestamp = response.Resource.Timestamp; } } } else { if (response.Resource != null) { if (operation.RetrieveResolver == null) { result.Result = EntityHelpers.GetEntityFromDocument(response.Resource, context); } else { IDictionary <string, EntityProperty> properties = EntityHelpers.GetEntityFromDocument(response.Resource, context).WriteEntity(context); if (options != null && options.EncryptionPolicy != null) { properties = EntityHelpers.DecryptEntityProperties(properties, options, response); } result.Result = operation.RetrieveResolver(response.Resource.GetPropertyValue <string>(StellarConstants.TableDatabaseName), response.Resource.Id, response.Resource.Timestamp, properties, response.Resource.ETag); } } } return(result); }