/// <summary> /// Get the mapped field entry given a specific migration source Unique Id and source field name /// </summary> /// <param name="sourceSide"></param> /// <param name="fieldName"></param> /// <returns></returns> public MappedField GetMappedFieldEntry(SourceSideTypeEnum sourceSide, string fieldName) { MappedField retVal = null; foreach (MappedField mappedField in this.MappedField) { if (mappedField.MapFromSide == sourceSide) { if (fieldName == (sourceSide == SourceSideTypeEnum.Left ? mappedField.LeftName : mappedField.RightName)) { retVal = mappedField; break; } else { if (sourceSide == SourceSideTypeEnum.Left && mappedField.LeftName == WitMappingConfigVocab.Any && retVal == null) { retVal = mappedField; } else if (sourceSide == SourceSideTypeEnum.Right && mappedField.RightName == WitMappingConfigVocab.Any && retVal == null) { retVal = mappedField; } continue; } } } return(retVal); }
/// <summary> /// Get the mapped field name from a particular side of a MappedField entry /// </summary> /// <param name="sourceSide"></param> /// <param name="mappedFieldEntry"></param> /// <returns>The name of the mapped field</returns> public string GetMappedFieldName( SourceSideTypeEnum sourceSide, string sourceFieldName, MappedField mappedFieldEntry) { if (null == mappedFieldEntry) { throw new ArgumentNullException(); } return((sourceSide == SourceSideTypeEnum.Left) ? (mappedFieldEntry.RightName == WitMappingConfigVocab.Any ? sourceFieldName : mappedFieldEntry.RightName) : (mappedFieldEntry.LeftName == WitMappingConfigVocab.Any ? sourceFieldName : mappedFieldEntry.LeftName)); }