private void RebuildDefaultPayload() { var payload = new Dictionary <string, byte[]> { { PayloadKey.Language, GraphOptions.ToUtf8Buffer(_language) }, { PayloadKey.Source, GraphOptions.ToUtf8Buffer(_source) } }; if (_name != null) { payload.Add(PayloadKey.Name, GraphOptions.ToUtf8Buffer(_name)); } var readConsistencyLevel = ReadConsistencyLevel; if (readConsistencyLevel != null) { payload.Add(PayloadKey.ReadConsistencyLevel, GraphOptions.ToUtf8Buffer( GraphOptions.GetConsistencyName(readConsistencyLevel.Value))); } var writeConsistencyLevel = WriteConsistencyLevel; if (writeConsistencyLevel != null) { payload.Add(PayloadKey.WriteConsitencyLevel, GraphOptions.ToUtf8Buffer( GraphOptions.GetConsistencyName(writeConsistencyLevel.Value))); } if (ReadTimeoutMillis > 0) { payload.Add(PayloadKey.RequestTimeout, GraphOptions.ToBuffer(ReadTimeoutMillis)); } _defaultPayload = payload; }
internal IDictionary <string, byte[]> BuildPayload(IGraphStatement statement) { if (statement.GraphLanguage == null && statement.GraphName == null && statement.GraphSource == null && statement.ReadTimeoutMillis == 0) { if (!statement.IsSystemQuery || !_defaultPayload.ContainsKey(PayloadKey.Name)) { //The user has not used the graph settings at statement level //Or is a system query but there isn't a name defined at GraphOptions level return(_defaultPayload); } } var payload = new Dictionary <string, byte[]>(); Add(payload, PayloadKey.Language, statement.GraphLanguage, null); if (!statement.IsSystemQuery) { Add(payload, PayloadKey.Name, statement.GraphName, null); } Add(payload, PayloadKey.Source, statement.GraphSource, null); Add(payload, PayloadKey.ReadConsistencyLevel, statement.GraphReadConsistencyLevel == null ? null : GraphOptions.GetConsistencyName(statement.GraphReadConsistencyLevel.Value), null); Add(payload, PayloadKey.WriteConsitencyLevel, statement.GraphWriteConsistencyLevel == null ? null : GraphOptions.GetConsistencyName(statement.GraphWriteConsistencyLevel.Value), null); var readTimeout = statement.ReadTimeoutMillis != 0 ? statement.ReadTimeoutMillis : ReadTimeoutMillis; if (readTimeout > 0) { // only non-infinite timeouts needs to be included in the payload Add <long>(payload, PayloadKey.RequestTimeout, statement.ReadTimeoutMillis, 0, GraphOptions.ToBuffer); } return(payload); }