public void HandleResponse(GetResponse response) { if (response.ForceRetry) { Result = null; RequiresRetry = true; return; } switch (response.StatusCode) { case HttpStatusCode.NotModified: Result = (default(T), _changeVector); // value not changed return; case HttpStatusCode.NotFound: _session.RegisterMissing(_id); Result = default((T, string)); return; } if (response.Result != null) { var etag = response.Headers[Constants.Headers.Etag]; var res = JsonDeserializationClient.ConditionalGetResult((BlittableJsonReaderObject)response.Result); var documentInfo = DocumentInfo.GetNewDocumentInfo((BlittableJsonReaderObject)res.Results[0]); var r = _session.TrackEntity <T>(documentInfo); Result = (r, etag); return; } Result = null; _session.RegisterMissing(_id); }
public T[] Complete <T>() { for (var i = 0; i < includeResults.Length; i++) { var include = includeResults[i]; sessionOperations.TrackIncludedDocument(include); } var transformedResults = TransformResults().ToList(); var finalResults = transformedResults.Select(ApplyTrackingIfNeeded <T>) .ToArray(); for (var i = 0; i < finalResults.Length; i++) { if (ReferenceEquals(finalResults[i], null)) { sessionOperations.RegisterMissing(ids[i]); } } var includePaths = includes != null?includes.Select(x => x.Key).ToArray() : null; sessionOperations.RegisterMissingIncludes(results.Where(x => x != null).Select(x => x.DataAsJson), includePaths); return(finalResults); }
public T[] Complete <T>() { for (var i = 0; i < includeResults.Length; i++) { var include = includeResults[i]; var entityType = includes.Length > i ? includes[i].Value : typeof(object); sessionOperations.TrackEntity(entityType, include); } var finalResults = SelectResults() .Select(document => document == null ? default(T) : sessionOperations.TrackEntity <T>(document)) .ToArray(); for (var i = 0; i < finalResults.Length; i++) { if (ReferenceEquals(finalResults[i], null)) { sessionOperations.RegisterMissing(ids[i]); } } var includePaths = includes != null?includes.Select(x => x.Key).ToArray() : null; sessionOperations.RegisterMissingIncludes(results.Where(x => x != null).Select(x => x.DataAsJson), includePaths); return(finalResults); }
public T[] Complete <T>() { for (var i = 0; i < includeResults.Length; i++) { var include = includeResults[i]; sessionOperations.TrackIncludedDocument(include); } var finalResults = ids != null? ReturnResultsById <T>() : ReturnResults <T>(); for (var i = 0; i < finalResults.Length; i++) { var finalResult = finalResults[i]; if (ReferenceEquals(finalResult, null)) { sessionOperations.RegisterMissing(ids[i]); } } var includePaths = includes != null?includes.Select(x => x.Key).ToArray() : null; sessionOperations.RegisterMissingIncludes(results.Where(x => x != null).Select(x => x.DataAsJson), includePaths); return(finalResults); }
public virtual T Complete <T>() { if (documentFound == null) { sessionOperations.RegisterMissing(id); return(default(T)); } return(sessionOperations.TrackEntity <T>(documentFound)); }
public T[] Complete <T>() { foreach (var include in includeResults) { sessionOperations.TrackEntity <object>(include); } var finalResults = SelectResults() .Select(document => document == null ? default(T) : sessionOperations.TrackEntity <T>(document)) .ToArray(); for (var i = 0; i < finalResults.Length; i++) { if (ReferenceEquals(finalResults[i], null)) { sessionOperations.RegisterMissing(ids[i]); } } sessionOperations.RegisterMissingIncludes(results.Where(x => x != null).Select(x => x.DataAsJson), includes); return(finalResults); }