Example #1
0
 public abstract HashSet <string> GetMappedDataFieldNames(SyncSide syncSide, DataMapFieldType includedFieldTypes, string prefix = "");
Example #2
0
        public override HashSet <string> GetMappedDataFieldNames(SyncSide syncSide, DataMapFieldType includedFieldTypes = DataMapFieldType.All, string prefix = "")
        {
            HashSet <string> dataFields = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            if (syncSide == SyncSide.Source)
            {
                if (includedFieldTypes.HasFlag(DataMapFieldType.PrimaryKey) || includedFieldTypes.HasFlag(DataMapFieldType.All))
                {
                    foreach (var primaryKey in SourceDefinition.PrimaryKeyColumnNames)
                    {
                        dataFields.Add(prefix + primaryKey);
                    }
                }

                if (includedFieldTypes.HasFlag(DataMapFieldType.SecondaryKey) || includedFieldTypes.HasFlag(DataMapFieldType.All))
                {
                    foreach (var secondaryKey in SourceDefinition.SecondaryKeyColumnNames)
                    {
                        dataFields.Add(prefix + secondaryKey);
                    }
                }

                if (includedFieldTypes.HasFlag(DataMapFieldType.CompareField) || includedFieldTypes.HasFlag(DataMapFieldType.All))
                {
                    foreach (var compareField in CompareFields)
                    {
                        dataFields.Add(prefix + compareField.SourceFieldToCompare);
                    }
                }

                if (includedFieldTypes.HasFlag(DataMapFieldType.DataOnlyField) || includedFieldTypes.HasFlag(DataMapFieldType.All))
                {
                    foreach (var dataOnlyField in SourceDefinition.DataOnlyFields)
                    {
                        dataFields.Add(prefix + dataOnlyField.FieldName);
                    }
                }
            }
            else if (syncSide == SyncSide.Target)
            {
                if (includedFieldTypes.HasFlag(DataMapFieldType.PrimaryKey) || includedFieldTypes.HasFlag(DataMapFieldType.All))
                {
                    foreach (var primaryKey in TargetDefinition.PrimaryKeyColumnNames)
                    {
                        dataFields.Add(prefix + primaryKey);
                    }
                }

                if (includedFieldTypes.HasFlag(DataMapFieldType.SecondaryKey) || includedFieldTypes.HasFlag(DataMapFieldType.All))
                {
                    foreach (var secondaryKey in TargetDefinition.SecondaryKeyColumnNames)
                    {
                        dataFields.Add(prefix + secondaryKey);
                    }
                }

                if (includedFieldTypes.HasFlag(DataMapFieldType.CompareField) || includedFieldTypes.HasFlag(DataMapFieldType.All))
                {
                    foreach (var compareField in CompareFields)
                    {
                        dataFields.Add(prefix + compareField.TargetFieldToCompare);
                    }
                }

                if (includedFieldTypes.HasFlag(DataMapFieldType.DataOnlyField) || includedFieldTypes.HasFlag(DataMapFieldType.All))
                {
                    foreach (var dataOnlyField in TargetDefinition.DataOnlyFields)
                    {
                        dataFields.Add(prefix + dataOnlyField.FieldName);
                    }
                }
            }
            else
            {
                throw new EnumValueNotImplementedException <SyncSide>(syncSide);
            }

            if (includedFieldTypes.HasFlag(DataMapFieldType.CustomSetField) || includedFieldTypes.HasFlag(DataMapFieldType.All))
            {
                foreach (var customSetField in CustomSetFields.Where(d => d.SyncSide == syncSide))
                {
                    dataFields.Add(prefix + customSetField.FieldNameToCompare);
                }
            }

            return(dataFields);
        }