예제 #1
0
        private int writeHeaders(BinaryWriter writer)
        {
            var count = 0;

            writer.WriteProp(ref count, SourceKey, Source);
            writer.WriteProp(ref count, MessageTypeKey, MessageType);
            writer.WriteProp(ref count, ReplyUriKey, ReplyUri);
            writer.WriteProp(ref count, ContentTypeKey, ContentType);
            writer.WriteProp(ref count, CorrelationIdKey, CorrelationId);
            writer.WriteProp(ref count, ParentIdKey, CausationId);
            writer.WriteProp(ref count, DestinationKey, Destination);
            writer.WriteProp(ref count, SagaIdKey, SagaId);

            if (AcceptedContentTypes != null && AcceptedContentTypes.Any())
            {
                writer.WriteProp(ref count, AcceptedContentTypesKey, AcceptedContentTypes.Join(","));
            }

            writer.WriteProp(ref count, IdKey, Id);
            writer.WriteProp(ref count, ReplyRequestedKey, ReplyRequested);
            writer.WriteProp(ref count, AckRequestedKey, AckRequested);

            if (ExecutionTime.HasValue)
            {
                var dateString = ExecutionTime.Value.ToUniversalTime()
                                 .ToString("yyyy-MM-ddTHH:mm:ss.fffffff", CultureInfo.InvariantCulture);
                count++;
                writer.Write(ExecutionTimeKey);
                writer.Write(dateString);
            }


            writer.WriteProp(ref count, AttemptsKey, Attempts);
            writer.WriteProp(ref count, DeliverByHeader, DeliverBy);
            writer.WriteProp(ref count, SentAttemptsHeaderKey, SentAttempts);
            writer.WriteProp(ref count, ReceivedAtKey, ReceivedAt);

            foreach (var pair in Headers)
            {
                count++;
                writer.Write(pair.Key);
                writer.Write(pair.Value);
            }


            return(count);
        }
예제 #2
0
        public void WriteToDictionary(IDictionary <string, object> dictionary)
        {
            dictionary.WriteProp(SourceKey, Source);
            dictionary.WriteProp(MessageTypeKey, MessageType);
            dictionary.WriteProp(ReplyUriKey, ReplyUri);
            dictionary.WriteProp(ContentTypeKey, ContentType);
            dictionary.WriteProp(CorrelationIdKey, CorrelationId);
            dictionary.WriteProp(ParentIdKey, CausationId);
            dictionary.WriteProp(DestinationKey, Destination);
            dictionary.WriteProp(SagaIdKey, SagaId);

            if (AcceptedContentTypes != null && AcceptedContentTypes.Any())
            {
                dictionary.WriteProp(AcceptedContentTypesKey, AcceptedContentTypes.Join(","));
            }

            dictionary.WriteProp(IdKey, Id);
            dictionary.WriteProp(ReplyRequestedKey, ReplyRequested);
            dictionary.WriteProp(AckRequestedKey, AckRequested);

            if (ExecutionTime.HasValue)
            {
                var dateString = ExecutionTime.Value.ToUniversalTime()
                                 .ToString("yyyy-MM-ddTHH:mm:ss.fffffff", CultureInfo.InvariantCulture);
                dictionary.Add(ExecutionTimeKey, dateString);
            }


            dictionary.WriteProp(AttemptsKey, Attempts);
            dictionary.WriteProp(DeliverByHeader, DeliverBy);
            dictionary.WriteProp(SentAttemptsHeaderKey, SentAttempts);
            dictionary.WriteProp(ReceivedAtKey, ReceivedAt);

            foreach (var pair in Headers)
            {
                dictionary.Add(pair.Key, pair.Value);
            }
        }
예제 #3
0
 public static bool IsAcceptedContentType(this IFormFile formFile) => AcceptedContentTypes.Contains(formFile.ContentType);