Удаление escape-последовательностей при записи в базу данных файла XML в столбец типа XML - PullRequest
0 голосов
/ 09 апреля 2020
string xmlMessage = importTransaction.Message.InnerXml;
                                var xDoc = XDocument.Parse(xmlMessage);
                                var order = xDoc.Descendants("ORDER").Single();
                                string orderName = order.Attribute("ORDER_NAME").Value;
                                string containerName = order.Attribute("INVENTORY_CNTNR_NAME").Value;
                                var emailBody = new
                                {
                                    ERROR_MESSAGE = "Not able to process the message by Import Service,Please Check if data is Valid!!",
                                    TRANSACTION_ID = processingTxn,
                                    ORDER_NAME = orderName,
                                    LODNUM=containerName,
                                }.ToPropertiesStringDictionary();

                                log.InfoFormat("Import for transaction type: [{0}] with id: [{1}] and Message: [{2}] was not processed!!!Please check Email", this.transactionType, processingTxn, importTransaction.Message.InnerXml);

                                using (var eventDirector = new WcfServiceClientHelper<IEventDirector>(this.eventDirectorFactory))
                                {
                                    // Log with EventDirector
                                    eventDirector.Call(x => x.Record(ApplicationID.ExactaConnect,
                                                                     DateTime.Now,
                                                                     EventType.IMPORT_ADAPTER_TRANSLATION_FAILURE,
                                                                     null,
                                                                     EventSeverity.Warning,
                                                                     emailBody));
                                    log.InfoFormat("Creating an Event Transaction for SMTP Failure Notification of Import translation for the transaction id:{0}", processingTxn);
                                }

XML: не удалось обработать сообщение с помощью службы экспорта. Проверьте правильность данных! « P0000000006C01272020114236 МПК Lane1 P0000000006 C '

...