private XDocument Format(IEpcisResponse entity) { switch (entity) { case GetStandardVersionResponse getStandardVersionResponse: return(FormatInternal(getStandardVersionResponse)); case GetVendorVersionResponse getVendorVersionResponse: return(FormatInternal(getVendorVersionResponse)); case ExceptionResponse exceptionResponse: return(FormatInternal(exceptionResponse)); case GetQueryNamesResponse getQueryNamesResponse: return(FormatInternal(getQueryNamesResponse)); case GetSubscriptionIdsResponse getSubscriptionIdsResponse: return(FormatInternal(getSubscriptionIdsResponse)); case PollResponse pollResponse: return(FormatInternal(pollResponse)); default: throw new NotImplementedException($"Unable to format '{entity.GetType()}'"); } }
private static XElement Format(IEpcisResponse entity, CancellationToken cancellationToken) { return(entity switch { GetStandardVersionResponse standardVersion => FormatGetStandardVersionResponse(standardVersion), GetVendorVersionResponse vendorVersion => FormatGetVendorVersionResponse(vendorVersion), ExceptionResponse exception => FormatInternal(exception), GetQueryNamesResponse queryNames => FormatGetQueryNamesResponse(queryNames), GetSubscriptionIdsResponse subscriptionIds => FormatGetSubscriptionIdsResponse(subscriptionIds), PollResponse poll => FormatPollResponse(poll, cancellationToken), _ => throw new NotImplementedException($"Unable to format '{entity.GetType()}'") });