/// <summary> /// Tries to set the legacy partition id guid field on the <see cref="Contracts.ConsumerSubscriptionRequest"/> if the partition id is a guid. /// </summary> /// <param name="req">The <see cref="Contracts.ConsumerSubscriptionRequest"/>.</param> public static void TrySetPartitionIdLegacy(this Contracts.ConsumerSubscriptionRequest req) { if (Guid.TryParse(req.PartitionId, out var partitionGuid)) { req.PartitionIdLegacy = partitionGuid.ToProtobuf(); } }
/// <summary> /// Gets the <see cref="PartitionId"/> from a <see cref="Contracts.ConsumerSubscriptionRequest"/>. /// </summary> /// <param name="req">The <see cref="Contracts.ConsumerSubscriptionRequest"/> to get the.</param> /// <returns>The <see cref="PartitionId"/> from the request.</returns> public static PartitionId GetPartitionId(this Contracts.ConsumerSubscriptionRequest req) => req.PartitionId ?? req.PartitionIdLegacy.ToGuid().ToString();