Execute() публичный статический Метод

해당 제품 DB에 대해 요청정보를 처리한 후 결과를 반환합니다.
public static Execute ( XdsRequestDocument xdsRequest, string productName ) : XdsResponseDocument
xdsRequest NSoft.NFramework.XmlData.Messages.XdsRequestDocument
productName string
Результат NSoft.NFramework.XmlData.Messages.XdsResponseDocument
Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="requestStream"></param>
        /// <param name="productName"></param>
        /// <param name="serializer"></param>
        /// <returns></returns>
        public static Stream ExecuteStreamInternal(Stream requestStream, string productName, ISerializer serializer)
        {
            XdsResponseDocument xdsResponse = null;
            MemoryStream        result      = null;

            try {
                Guard.Assert(requestStream != null && requestStream.Length > 0, "요청 정보가 없습니다.");
                CheckProductExists(productName);

                var xdsRequest = (XdsRequestDocument)serializer.Deserialize(requestStream.ToBytes());
                xdsResponse = XmlDataServiceFacade.Execute(xdsRequest, productName);
            }
            catch (Exception ex) {
                if (log.IsErrorEnabled)
                {
                    log.ErrorException("예외가 발생했습니다.", ex);
                }

                if (xdsResponse == null)
                {
                    xdsResponse = new XdsResponseDocument();
                }
                xdsResponse.ReportError(ex);
            }
            finally {
                result = new MemoryStream(serializer.Serialize(xdsResponse));
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="requestBytes"></param>
        /// <param name="productName"></param>
        /// <param name="serializer"></param>
        /// <returns></returns>
        public static byte[] Execute(byte[] requestBytes, string productName, ISerializer serializer)
        {
            if (productName.IsWhiteSpace())
            {
                productName = AdoTool.DefaultDatabaseName;
            }

            XdsResponseDocument xdsResponse = null;

            byte[] result = null;

            try {
                Guard.Assert(requestBytes != null && requestBytes.Length > 0, "요청 정보가 없습니다.");
                XmlDataServiceFacade.CheckProductExists(productName);

                var requestData = (byte[])serializer.Deserialize(requestBytes);
                var xdsRequest  = requestData.ConvertToXdsRequestDocument(XmlTool.XmlEncoding);
                xdsResponse = XmlDataServiceFacade.Execute(xdsRequest, productName);
            }
            catch (Exception ex) {
                if (log.IsErrorEnabled)
                {
                    log.ErrorException("예외가 발생했습니다.", ex);
                }

                if (xdsResponse == null)
                {
                    xdsResponse = new XdsResponseDocument();
                }
                xdsResponse.ReportError(ex);
            }
            finally {
                byte[] xdsResponseBytes;
                XmlTool.Serialize(xdsResponse, out xdsResponseBytes);

                result = serializer.Serialize(xdsResponseBytes);
            }
            return(result);
        }