示例#1
0
        /// <summary>
        /// Converts a data object collection to XML and optionally converts to a requested version.
        /// </summary>
        /// <param name="request">The GetFromStore request.</param>
        /// <param name="collection">The data object collection.</param>
        /// <returns></returns>
        private string GetXmlOut(WMLS_GetFromStoreRequest request, IEnergisticsCollection collection)
        {
            if (collection == null)
            {
                return(string.Empty);
            }
            EnsureCapServerProviders();

            var    optionsIn = WitsmlOperationContext.Current.OptionsIn;
            string requestedVersion;

            // Attempt transformation if client requested a different version
            if (optionsIn.TryGetValue(OptionsIn.DataVersion.Keyword, out requestedVersion) &&
                _capServerMap.ContainsKey(requestedVersion) &&
                collection.GetVersion() != requestedVersion)
            {
                _log.Debug($"Transforming XMLOut to data schema version {requestedVersion}");
                collection = WitsmlParser.Transform(collection, requestedVersion);
            }

            return(WitsmlParser.ToXml(collection));
        }