public MultiGetResponse DeserializeMultiGetResponse(ConnectionStatus c, MultiGetDescriptor d) { var multiGetHitConverter = new MultiGetHitConverter(d); var multiGetResponse = this.DeserializeInternal <MultiGetResponse>(c, piggyBackJsonConverter: multiGetHitConverter); return(multiGetResponse); }
private ConnectionStatus _multiGetUsingDescriptor(Action <MultiGetDescriptor> multiGetSelector, out MultiGetDescriptor descriptor) { multiGetSelector.ThrowIfNull("multiGetSelector"); descriptor = new MultiGetDescriptor(); multiGetSelector(descriptor); var data = @"{ ""docs"" : ["; var objects = new List <string>(); descriptor._GetOperations.ThrowIfEmpty("MultiGetFull called but no get operations were specified"); foreach (var g in descriptor._GetOperations) { string objectJson = "{"; var properties = new List <string>(); if (descriptor._FixedIndex.IsNullOrEmpty()) { var index = string.IsNullOrEmpty(g._Index) ? this.Infer.IndexName(g._ClrType) : g._Index; properties.Add(@"""_index"" : " + this.Serialize(index)); } if (descriptor._FixedType.IsNullOrEmpty()) { var type = this.ResolveTypeName(g._Type, this.Infer.TypeName(g._ClrType)); properties.Add(@"""_type"" : " + this.Serialize(type)); } properties.Add(@"""_id"" : " + this.Serialize(g._Id)); if (!g._Routing.IsNullOrEmpty()) { properties.Add(@"""_routing"" : " + this.Serialize(g._Routing)); } if (g._Fields.HasAny()) { properties.Add(@"""fields"" : " + this.Serialize(g._Fields)); } objectJson += string.Join(", ", properties); objectJson += "}"; objects.Add(objectJson); } data += string.Join(", ", objects); data += "] }"; var path = ""; if (!descriptor._FixedIndex.IsNullOrEmpty()) { path += descriptor._FixedIndex; if (!descriptor._FixedIndex.IsNullOrEmpty()) { path += "/" + descriptor._FixedType; } } path += "/_mget"; var response = this.Connection.PostSync(path, data); return(response); }
private JsonConverter CreateCovariantMultiGetConverter(MultiGetDescriptor descriptor) { var multiGetHitConverter = new MultiGetHitConverter(descriptor); return(multiGetHitConverter); }