/// <summary> /// Gets the table storage request for the given settings and values /// </summary> public TableStorageRequest GetTableStorageRequest(TableStorageSettings settings, DbParameterCollection parameters) { var rowKey = string.Empty; var partitionKey = string.Empty; var requestParameters = new List<string>(); var bodyParameters = new List<string>(); for (var i = setIndex + 1; i < whereIndex; i += 3) { bodyParameters.Add(commandTextParts[i]); } var rowKeyIndex = Array.FindIndex(commandTextParts, s => s == "RowKey"); var rowKeyValueIndex = commandTextParts[rowKeyIndex + 2]; var rowKeyValue = rowKeyValueIndex == "null" ? null : parameters[int.Parse(rowKeyValueIndex.TrimStart('p'))].Value.ToString(); requestParameters.Add("RowKey=" + "'" + rowKeyValue + "'"); rowKey = rowKeyValue; var partitionKeyIndex = Array.FindIndex(commandTextParts, s => s == "PartitionKey"); var partitionKeyValueIndex = commandTextParts[partitionKeyIndex + 2]; var partitionKeyValue = partitionKeyValueIndex == "null" ? null : parameters[int.Parse(partitionKeyValueIndex.TrimStart('p'))].Value.ToString(); requestParameters.Add("PartitionKey=" + "'" + partitionKeyValue + "'"); partitionKey = partitionKeyValue; var uri = String.Format(settings.Uri.AbsoluteUri + "{0}({1})", tableName, String.Join(",", requestParameters.ToArray())); var request = new TableStorageRequest(StorageHttpConstants.HttpMethod.Merge, uri, settings) { IfMatch = Tracker.GetIfMatchHeaderFor(tableName, rowKey, partitionKey) }; for (var i = 0; i < bodyParameters.Count; i++) { request.Body.AddProperty(bodyParameters[i], parameters[i].Value, parameters[i].DbType); } return request; }
/// <summary> /// Gets the table storage request for the given settings and values /// </summary> public TableStorageRequest GetTableStorageRequest(TableStorageSettings settings, DbParameterCollection parameters) { var parameterNames = new string[parameters.Count]; Array.Copy(commandTextParts, 3, parameterNames, 0, parameters.Count); var request = new TableStorageRequest(StorageHttpConstants.HttpMethod.Post, String.Format(settings.Uri.AbsoluteUri + "{0}", tableName), settings); for (var i = 0; i < parameterNames.Length; i++) { request.Body.AddProperty(parameterNames[i], parameters[i].Value, parameters[i].DbType); } return request; }
/// <summary> /// Gets the table storage request for the given settings and values /// </summary> public TableStorageRequest GetTableStorageRequest(TableStorageSettings settings, DbParameterCollection parameters) { var requestParameters = new List<string>(); var rowKeyIndex = Array.FindIndex(commandTextParts, s => s == "RowKey"); var rowKeyValueIndex = commandTextParts[rowKeyIndex + 2]; var rowKeyValue = rowKeyValueIndex == "null" ? null : parameters[int.Parse(rowKeyValueIndex.TrimStart('p'))].Value.ToString(); requestParameters.Add("RowKey=" + "'" + rowKeyValue + "'"); var partitionKeyIndex = Array.FindIndex(commandTextParts, s => s == "PartitionKey"); var partitionKeyValueIndex = commandTextParts[partitionKeyIndex + 2]; var partitionKeyValue = partitionKeyValueIndex == "null" ? null : parameters[int.Parse(partitionKeyValueIndex.TrimStart('p'))].Value.ToString(); requestParameters.Add("PartitionKey=" + "'" + partitionKeyValue + "'"); var uri = String.Format(settings.Uri.AbsoluteUri + "{0}({1})", tableName, String.Join(",", requestParameters.ToArray())); var request = new TableStorageRequest(StorageHttpConstants.HttpMethod.Delete, uri, settings) { IfMatch = "*" }; return request; }
/// <summary> /// Gets the table storage request for the given settings and values /// </summary> public TableStorageRequest GetTableStorageRequest(TableStorageSettings settings, DbParameterCollection parameters) { var request = new TableStorageRequest(StorageHttpConstants.HttpMethod.Post, String.Format(settings.Uri.AbsoluteUri + "{0}", "Tables"), settings); request.Body.AddProperty("TableName", tableName); return request; }
/// <summary> /// Create a new instance of TableStorageDataReader /// </summary> /// <param name="request"></param> public TableStorageDataReader(TableStorageRequest request, ETagTracker tracker) { this.request = request; this.Tracker = tracker; }