Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
4,750 additions
and
4,750 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NLog" version="2.0.0.2000" /> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NLog" version="2.0.0.2000" /> | ||
</packages> |
262 changes: 131 additions & 131 deletions
262
Raven.Client.Lightweight/Connection/CreateHttpJsonRequestParams.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,132 +1,132 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Specialized; | ||
using System.Linq; | ||
using System.Net; | ||
using Raven.Client.Connection.Profiling; | ||
using Raven.Client.Document; | ||
using Raven.Json.Linq; | ||
|
||
namespace Raven.Client.Connection | ||
{ | ||
public class CreateHttpJsonRequestParams | ||
{ | ||
public CreateHttpJsonRequestParams(IHoldProfilingInformation self, string url, string method, RavenJObject metadata, ICredentials credentials, DocumentConvention convention) | ||
{ | ||
Owner = self; | ||
Url = url; | ||
Method = method; | ||
Metadata = metadata; | ||
Credentials = credentials; | ||
Convention = convention; | ||
operationsHeadersColletion = new NameValueCollection(); | ||
} | ||
|
||
/// <summary> | ||
/// Adds the operation headers. | ||
/// </summary> | ||
/// <param name="operationsHeaders">The operations headers.</param> | ||
public CreateHttpJsonRequestParams AddOperationHeaders(IDictionary<string, string> operationsHeaders) | ||
{ | ||
urlCached = null; | ||
operationsHeadersDictionary = operationsHeaders; | ||
foreach (var operationsHeader in operationsHeaders) | ||
{ | ||
operationHeadersHash = (operationHeadersHash*397) ^ operationsHeader.Key.GetHashCode(); | ||
if (operationsHeader.Value != null) | ||
{ | ||
operationHeadersHash = (operationHeadersHash * 397) ^ operationsHeader.Value.GetHashCode(); | ||
} | ||
} | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Adds the operation headers. | ||
/// </summary> | ||
/// <param name="operationsHeaders">The operations headers.</param> | ||
public CreateHttpJsonRequestParams AddOperationHeaders(NameValueCollection operationsHeaders) | ||
{ | ||
urlCached = null; | ||
operationsHeadersColletion = operationsHeaders; | ||
foreach (string operationsHeader in operationsHeadersColletion) | ||
{ | ||
operationHeadersHash = (operationHeadersHash * 397) ^ operationsHeader.GetHashCode(); | ||
var values = operationsHeaders.GetValues(operationsHeader); | ||
if (values == null) | ||
continue; | ||
|
||
foreach (var header in values.Where(header => header != null)) | ||
{ | ||
operationHeadersHash = (operationHeadersHash * 397) ^ header.GetHashCode(); | ||
} | ||
} | ||
return this; | ||
} | ||
|
||
public void UpdateHeaders(WebRequest webRequest) | ||
{ | ||
if (operationsHeadersDictionary != null) | ||
{ | ||
foreach (var kvp in operationsHeadersDictionary) | ||
{ | ||
webRequest.Headers[kvp.Key] = kvp.Value; | ||
} | ||
} | ||
if(operationsHeadersColletion != null) | ||
{ | ||
foreach (string header in operationsHeadersColletion) | ||
{ | ||
try | ||
{ | ||
webRequest.Headers[header] = operationsHeadersColletion[header]; | ||
} | ||
catch (Exception e) | ||
{ | ||
throw new InvalidOperationException( | ||
"Failed to set header '" + header + "' to the value: " + operationsHeadersColletion[header], e); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public CreateHttpJsonRequestParams(IHoldProfilingInformation self, string url, string method, ICredentials credentials, DocumentConvention convention) | ||
: this(self, url, method, new RavenJObject(), credentials, convention) | ||
{ | ||
|
||
} | ||
|
||
private int operationHeadersHash; | ||
private NameValueCollection operationsHeadersColletion; | ||
private IDictionary<string, string> operationsHeadersDictionary; | ||
public IHoldProfilingInformation Owner { get; set; } | ||
private string url; | ||
private string urlCached; | ||
|
||
public string Url | ||
{ | ||
get | ||
{ | ||
if (urlCached != null) | ||
return urlCached; | ||
urlCached = GenerateUrl(); | ||
return urlCached; | ||
} | ||
set { url = value; } | ||
} | ||
|
||
private string GenerateUrl() | ||
{ | ||
if (operationHeadersHash == 0) | ||
return url; | ||
if (url.Contains("?")) | ||
return url + "&operationHeadersHash=" + operationHeadersHash; | ||
return url + "?operationHeadersHash=" + operationHeadersHash; | ||
} | ||
|
||
public string Method { get; set; } | ||
public RavenJObject Metadata { get; set; } | ||
public ICredentials Credentials { get; set; } | ||
public DocumentConvention Convention { get; set; } | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Specialized; | ||
using System.Linq; | ||
using System.Net; | ||
using Raven.Client.Connection.Profiling; | ||
using Raven.Client.Document; | ||
using Raven.Json.Linq; | ||
|
||
namespace Raven.Client.Connection | ||
{ | ||
public class CreateHttpJsonRequestParams | ||
{ | ||
public CreateHttpJsonRequestParams(IHoldProfilingInformation self, string url, string method, RavenJObject metadata, ICredentials credentials, DocumentConvention convention) | ||
{ | ||
Owner = self; | ||
Url = url; | ||
Method = method; | ||
Metadata = metadata; | ||
Credentials = credentials; | ||
Convention = convention; | ||
operationsHeadersColletion = new NameValueCollection(); | ||
} | ||
|
||
/// <summary> | ||
/// Adds the operation headers. | ||
/// </summary> | ||
/// <param name="operationsHeaders">The operations headers.</param> | ||
public CreateHttpJsonRequestParams AddOperationHeaders(IDictionary<string, string> operationsHeaders) | ||
{ | ||
urlCached = null; | ||
operationsHeadersDictionary = operationsHeaders; | ||
foreach (var operationsHeader in operationsHeaders) | ||
{ | ||
operationHeadersHash = (operationHeadersHash*397) ^ operationsHeader.Key.GetHashCode(); | ||
if (operationsHeader.Value != null) | ||
{ | ||
operationHeadersHash = (operationHeadersHash * 397) ^ operationsHeader.Value.GetHashCode(); | ||
} | ||
} | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Adds the operation headers. | ||
/// </summary> | ||
/// <param name="operationsHeaders">The operations headers.</param> | ||
public CreateHttpJsonRequestParams AddOperationHeaders(NameValueCollection operationsHeaders) | ||
{ | ||
urlCached = null; | ||
operationsHeadersColletion = operationsHeaders; | ||
foreach (string operationsHeader in operationsHeadersColletion) | ||
{ | ||
operationHeadersHash = (operationHeadersHash * 397) ^ operationsHeader.GetHashCode(); | ||
var values = operationsHeaders.GetValues(operationsHeader); | ||
if (values == null) | ||
continue; | ||
|
||
foreach (var header in values.Where(header => header != null)) | ||
{ | ||
operationHeadersHash = (operationHeadersHash * 397) ^ header.GetHashCode(); | ||
} | ||
} | ||
return this; | ||
} | ||
|
||
public void UpdateHeaders(WebRequest webRequest) | ||
{ | ||
if (operationsHeadersDictionary != null) | ||
{ | ||
foreach (var kvp in operationsHeadersDictionary) | ||
{ | ||
webRequest.Headers[kvp.Key] = kvp.Value; | ||
} | ||
} | ||
if(operationsHeadersColletion != null) | ||
{ | ||
foreach (string header in operationsHeadersColletion) | ||
{ | ||
try | ||
{ | ||
webRequest.Headers[header] = operationsHeadersColletion[header]; | ||
} | ||
catch (Exception e) | ||
{ | ||
throw new InvalidOperationException( | ||
"Failed to set header '" + header + "' to the value: " + operationsHeadersColletion[header], e); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public CreateHttpJsonRequestParams(IHoldProfilingInformation self, string url, string method, ICredentials credentials, DocumentConvention convention) | ||
: this(self, url, method, new RavenJObject(), credentials, convention) | ||
{ | ||
|
||
} | ||
|
||
private int operationHeadersHash; | ||
private NameValueCollection operationsHeadersColletion; | ||
private IDictionary<string, string> operationsHeadersDictionary; | ||
public IHoldProfilingInformation Owner { get; set; } | ||
private string url; | ||
private string urlCached; | ||
|
||
public string Url | ||
{ | ||
get | ||
{ | ||
if (urlCached != null) | ||
return urlCached; | ||
urlCached = GenerateUrl(); | ||
return urlCached; | ||
} | ||
set { url = value; } | ||
} | ||
|
||
private string GenerateUrl() | ||
{ | ||
if (operationHeadersHash == 0) | ||
return url; | ||
if (url.Contains("?")) | ||
return url + "&operationHeadersHash=" + operationHeadersHash; | ||
return url + "?operationHeadersHash=" + operationHeadersHash; | ||
} | ||
|
||
public string Method { get; set; } | ||
public RavenJObject Metadata { get; set; } | ||
public ICredentials Credentials { get; set; } | ||
public DocumentConvention Convention { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="IClientSideDatabase.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
using System.Collections.Generic; | ||
|
||
namespace Raven.Client.Indexes | ||
{ | ||
/// <summary> | ||
/// DatabaseAccessor for loading documents in the translator | ||
/// </summary> | ||
public interface IClientSideDatabase | ||
{ | ||
/// <summary> | ||
/// Loading a document during result transformers | ||
/// </summary> | ||
T Load<T>(string docId); | ||
|
||
/// <summary> | ||
/// Loading documents during result transformers | ||
/// </summary> | ||
T[] Load<T>(IEnumerable<string> docIds); | ||
|
||
/// <summary> | ||
/// Will ask RavenDB to include this document in the query results | ||
/// </summary> | ||
object Include(string docId); | ||
|
||
/// <summary> | ||
/// Will ask RavenDB to include these documents in the query results | ||
/// </summary> | ||
object Include(IEnumerable<string> docId); | ||
} | ||
//----------------------------------------------------------------------- | ||
// <copyright file="IClientSideDatabase.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
using System.Collections.Generic; | ||
|
||
namespace Raven.Client.Indexes | ||
{ | ||
/// <summary> | ||
/// DatabaseAccessor for loading documents in the translator | ||
/// </summary> | ||
public interface IClientSideDatabase | ||
{ | ||
/// <summary> | ||
/// Loading a document during result transformers | ||
/// </summary> | ||
T Load<T>(string docId); | ||
|
||
/// <summary> | ||
/// Loading documents during result transformers | ||
/// </summary> | ||
T[] Load<T>(IEnumerable<string> docIds); | ||
|
||
/// <summary> | ||
/// Will ask RavenDB to include this document in the query results | ||
/// </summary> | ||
object Include(string docId); | ||
|
||
/// <summary> | ||
/// Will ask RavenDB to include these documents in the query results | ||
/// </summary> | ||
object Include(IEnumerable<string> docId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="QueryResultWithIncludes.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
using System.Collections.Generic; | ||
using Raven.Abstractions.Data; | ||
|
||
namespace Raven.Database.Data | ||
{ | ||
public class QueryResultWithIncludes : QueryResult | ||
{ | ||
public HashSet<string> IdsToInclude { get; set; } | ||
} | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="QueryResultWithIncludes.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
using System.Collections.Generic; | ||
using Raven.Abstractions.Data; | ||
|
||
namespace Raven.Database.Data | ||
{ | ||
public class QueryResultWithIncludes : QueryResult | ||
{ | ||
public HashSet<string> IdsToInclude { get; set; } | ||
} | ||
} |
Oops, something went wrong.