private ReadCommandOperation <TResult> CreateRunCommandOperation <TResult>(Command <TResult> command) { var renderedCommand = command.Render(_settings.SerializerRegistry); var messageEncoderSettings = GetMessageEncoderSettings(); return(new ReadCommandOperation <TResult>(_databaseNamespace, renderedCommand.Document, renderedCommand.ResultSerializer, messageEncoderSettings)); }
public override Task <TResult> RunCommandAsync <TResult>(Command <TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default(CancellationToken)) { Ensure.IsNotNull(command, nameof(command)); readPreference = readPreference ?? ReadPreference.Primary; var renderedCommand = command.Render(_settings.SerializerRegistry); var messageEncoderSettings = GetMessageEncoderSettings(); var operation = new ReadCommandOperation <TResult>(_databaseNamespace, renderedCommand.Document, renderedCommand.ResultSerializer, messageEncoderSettings); return(ExecuteReadOperationAsync(operation, readPreference, cancellationToken)); }