Exemplo n.º 1
0
        public void Add(string sourceColumn, string destinationColumn, ColumnTransformDelegate columnTransform)
        {
            if (string.IsNullOrWhiteSpace(sourceColumn))
            {
                throw new ArgumentNullException(nameof(sourceColumn), "Destination column '" + destinationColumn + "' must have a corresponding source column.");
            }
            if (string.IsNullOrWhiteSpace(sourceColumn))
            {
                throw new ArgumentNullException(nameof(destinationColumn), "Source column '" + sourceColumn + "' must have a corresponding destination column.");
            }

            if (!ContainsSourceColumn(sourceColumn) && !ContainsDestinationColumn(destinationColumn))
            {
                SourceToDestination.Add(sourceColumn, destinationColumn);
                DestinationToSource.Add(destinationColumn, sourceColumn);
            }
            else if (ContainsSourceColumn(sourceColumn) && GetDestinationColumn(sourceColumn) != destinationColumn)
            {
                throw new ArgumentException("The source column '" + sourceColumn + "' cannot be mapped to destination column '" + destinationColumn + "' because it has already been mapped to the column '" + GetDestinationColumn(sourceColumn) + "'.");
            }
            else if (ContainsDestinationColumn(destinationColumn) && GetSourceColumn(destinationColumn) != sourceColumn)
            {
                throw new ArgumentException("The destination column '" + destinationColumn + "' cannot be mapped to source column '" + sourceColumn + "' because it has already been mapped to the column '" + GetSourceColumn(destinationColumn) + "'.");
            }

            if (columnTransform != null)
            {
                AddColumnTransform(sourceColumn, columnTransform);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds the specified column transform to the transform list at the specified location for the specified source column
 /// </summary>
 /// <param name="sourceColumn">The name of the source column for which to add the column transform</param>
 /// <param name="columnTransform">The transform delegate to add</param>
 /// <param name="executionOrder">The order of execution for this transform</param>
 public void AddColumnTransform(string sourceColumn, ColumnTransformDelegate columnTransform, int executionOrder)
 {
     AddColumnTransform(sourceColumn, new DataColumnTransform(columnTransform, executionOrder));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds the specified column transform to the end of the transform list for the specified source column
 /// </summary>
 /// <param name="sourceColumn">The name of the source column for which to add the column transform</param>
 /// <param name="columnTransform">The transform delegate to add</param>
 public void AddColumnTransform(string sourceColumn, ColumnTransformDelegate columnTransform)
 {
     AddColumnTransform(sourceColumn, columnTransform, GetMaxExecutionOrder(sourceColumn) + 1);
 }
Exemplo n.º 4
0
 public DataColumnTransform(ColumnTransformDelegate transform, int executionOrder)
     : this(transform)
 {
     ExecutionOrder = executionOrder;
 }
Exemplo n.º 5
0
 public DataColumnTransform(ColumnTransformDelegate transform)
 {
     Transform = transform;
 }
Exemplo n.º 6
0
 protected DataColumnTransform()
 {
     Transform = IdentityTransform;
 }