public async Task <Client> GetClientByIdAsync(int clientId) { var spec = new ClientSpecification(clientId); var client = (await GetAsync(spec)).FirstOrDefault(); return(client); }
public override int GetHashCode() { int hash = 1; if (typeCase_ == TypeOneofCase.Success) { hash ^= Success.GetHashCode(); } if (typeCase_ == TypeOneofCase.Error) { hash ^= Error.GetHashCode(); } if (typeCase_ == TypeOneofCase.ClientSpecification) { hash ^= ClientSpecification.GetHashCode(); } if (typeCase_ == TypeOneofCase.DeviceSpecification) { hash ^= DeviceSpecification.GetHashCode(); } hash ^= (int)typeCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void Matches_Client_With_ClientId_Spec() { var spec = new ClientSpecification(ClientBuilder.ClientId2); var result = ClientBuilder.GetClientsCollection() .AsQueryable() .FirstOrDefault(spec.Criteria); Assert.NotNull(result); Assert.Equal(ClientBuilder.ClientName2, result.Name); }
public void MergeFrom(ServiceReply other) { if (other == null) { return; } switch (other.TypeCase) { case TypeOneofCase.Success: if (Success == null) { Success = new global::Ubii.Service.Reply.Success(); } Success.MergeFrom(other.Success); break; case TypeOneofCase.Error: if (Error == null) { Error = new global::Ubii.Service.Reply.Error(); } Error.MergeFrom(other.Error); break; case TypeOneofCase.ClientSpecification: if (ClientSpecification == null) { ClientSpecification = new global::Ubii.Service.Reply.ClientSpecification(); } ClientSpecification.MergeFrom(other.ClientSpecification); break; case TypeOneofCase.DeviceSpecification: if (DeviceSpecification == null) { DeviceSpecification = new global::Ubii.Service.Reply.DeviceSpecification(); } DeviceSpecification.MergeFrom(other.DeviceSpecification); break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public async Task <IEnumerable <Client> > GetClientsByNameAsync(string clientName) { var spec = new ClientSpecification(clientName); return(await GetAsync(spec)); }