Exemple #1
0
        public static void Serialize(ErrorBatch entity, Stream requestStream)
        {
            var serializer = new JsonSerializer <ErrorBatch>();

            using (var textWriter = new StreamWriter(requestStream))
            {
                serializer.SerializeToWriter(entity, textWriter);
            }
        }
        protected virtual void Send(ErrorBatch errors)
        {
            var request = CreateRequest();

            using (var requestStream = request.GetRequestStream())
            {
                ErrorBatchSerializer.Serialize(errors, requestStream);
            }
            try
            {
                using (request.GetResponse())
                {
                    OnBatchDelivered(new ErrorBatchDeliveryInfo(errors));
                }
            }
            catch (WebException ex)
            {
                OnBatchDelivered(new ErrorBatchDeliveryInfo(errors, ex.HandleWebException()));
            }
        }
Exemple #3
0
 public ErrorBatchDeliveryInfo(ErrorBatch errorBatch)
 {
     ErrorBatch = errorBatch;
 }
Exemple #4
0
 public ErrorBatchDeliveryInfo(ErrorBatch errorBatch, Exception exception)
     : this(errorBatch)
 {
     Exception = exception;
 }
Exemple #5
0
        public static string Serialize(ErrorBatch entity)
        {
            var serializer = new JsonSerializer <ErrorBatch>();

            return(serializer.SerializeToString(entity));
        }