Raven.Abstractions.Data.IndexQuery.GetIndexQueryUrl C# (CSharp) Method

GetIndexQueryUrl() public method

Gets the index query URL.
public GetIndexQueryUrl ( string operationUrl, string index, string operationName ) : string
operationUrl string The operation URL.
index string The index.
operationName string Name of the operation.
return string
		public string GetIndexQueryUrl(string operationUrl, string index, string operationName)
		{
			if (operationUrl.EndsWith("/"))
				operationUrl = operationUrl.Substring(0, operationUrl.Length - 1);
			var path = new StringBuilder()
				.Append(operationUrl)
				.Append("/")
				.Append(operationName)
				.Append("/")
				.Append(index);

			AppendQueryString(path);



			return path.ToString();
		}

Usage Example

Exemplo n.º 1
0
		public Task DeleteByIndexAsync(string indexName, IndexQuery queryToDelete, bool allowStale)
		{
			string path = queryToDelete.GetIndexQueryUrl(url, indexName, "bulk_docs") + "&allowStale=" + allowStale;
			var request = jsonRequestFactory.CreateHttpJsonRequest(
				new CreateHttpJsonRequestParams(this, path, "DELETE", credentials, convention)
					.AddOperationHeaders(OperationsHeaders));
			
			return request.ExecuteRequestAsync()
				.ContinueWith(task =>
				{
					var aggregateException = task.Exception;
					if (aggregateException == null)
						return task;
					var e = aggregateException.ExtractSingleInnerException() as WebException;
					if (e == null)
						return task;
					var httpWebResponse = e.Response as HttpWebResponse;
					if (httpWebResponse != null && httpWebResponse.StatusCode == HttpStatusCode.NotFound)
						throw new InvalidOperationException("There is no index named: " + indexName, e);
					return task;
				}).Unwrap();
		}
All Usage Examples Of Raven.Abstractions.Data.IndexQuery::GetIndexQueryUrl