System.Data.RiakClient.RiakManagementRepository.PersistClientId C# (CSharp) Méthode

PersistClientId() public méthode

public PersistClientId ( PersistClientIdRequest request ) : RiakResponse
request System.Data.RiakClient.Models.PersistClientIdRequest
Résultat RiakResponse
        public RiakResponse<string> PersistClientId(PersistClientIdRequest request)
        {
            var r = Connection.WriteWith(request, RequestMethod.PersistClientId);
            return r.ResponseCode == RiakResponseCode.Failed
                ? RiakResponse<string>.WithErrors(r.Messages)
                : RiakResponse<string>.WithoutErrors(request.ClientId.DecodeToString());
        }

Usage Example

        public void ShouldPersistClientId()
        {
            // Arrange.
            var connection = new RiakConnection { Host = "192.168.30.118", Port = 8087 };
            var repository = new RiakManagementRepository(connection);

            // Act.
            var response = repository.PersistClientId(new PersistClientIdRequest {ClientId = BitConverter.GetBytes(1337)});

            // Assert.
            Assert.IsTrue(response.ResponseCode == RiakResponseCode.Successful);
        }