Ejemplo n.º 1
0
 public static string GetXPathByMapping(IMapping mapping)
 {
     if (mapping == null)
     {
         throw new ArgumentNullException(nameof(mapping));
     }
     return(mapping.GetProperty("XPath"));
 }
Ejemplo n.º 2
0
 public static IXmlMapping Convert(
     IMapping mapping,
     MappingDictionary mDict,
     bool nameAsXPath)
 {
     if (nameAsXPath && string.IsNullOrWhiteSpace(mapping.GetProperty("XPath")))
     {
         string columnName = mapping.ColumnName;
         mapping.Properties["XPath"] = columnName;
         if (mapping is IXmlMapping)
         {
             (mapping as IXmlMapping).XPath = columnName;
         }
     }
     return(XmlMapping.Convert(mapping, mDict));
 }
        public IList <string> GetNeededFields()
        {
            if (this._needFields == null)
            {
                this._needFields = (IList <string>) new List <string>(16);
                foreach (string mappingName in this.MappingNames)
                {
                    foreach (IMapping mapping1 in (IEnumerable <IMapping>) this.GetMappings(mappingName).Values)
                    {
                        IMapping        mapping = mapping1;
                        Action <string> action  = (Action <string>)(s =>
                        {
                            s = this.ProcessFieldID(s, mapping);
                            if (this._needFields.Contains(s))
                            {
                                return;
                            }
                            this._needFields.Add(s);
                        });
                        switch (mapping.TranslationType)
                        {
                        case TranslationType.Directly:
                            action(mapping.Translation);
                            break;

                        case TranslationType.Expression:
                        case TranslationType.Macro:
                            foreach (string str in Translator.GetNeededFieldsByTranslation(mapping.Translation).ToArray <string>())
                            {
                                action(str);
                            }
                            break;

                        default:
                            continue;
                        }
                        if (mapping.Properties.ContainsKey("DoNotExportCriteria"))
                        {
                            foreach (string str in (IEnumerable <string>)Translator.GetNeededFieldsByTranslation(mapping.GetProperty("DoNotExportCriteria")))
                            {
                                action(str);
                            }
                        }
                    }
                }
                if (!this._needFields.Contains("364"))
                {
                    this._needFields.Add("364");
                }
            }
            return(this._needFields);
        }