Ejemplo n.º 1
0
 /// <summary>
 /// Deserializes column values from string to typed value boxing in object.
 /// </summary>
 /// <param name="context">Context for processing elements.</param>
 public override void Process(ColumnValuesIteratorContext context)
 {
     foreach (var columnValue in context.ColumnValues)
     {
         if (columnValue.HasMacrosValue)
         {
             continue;
         }
         var boxedResult = Deserializers.TryBoxValue(columnValue, context);
         var result      = new ColumnValueResult(columnValue.ColumnUId)
         {
             Value = boxedResult
         };
         context.Results.Add(columnValue.ColumnUId, result);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Replaces macro with value in columns.
        /// </summary>
        /// <param name="context"></param>
        public override void Process(ColumnValuesIteratorContext context)
        {
            if (!context.MacrosValues.Any())
            {
                return;
            }
            var columnValues = context.ColumnValues.Where(c => c.HasMacrosValue && !c.IsTextColumn);

            foreach (var columnValue in columnValues)
            {
                var result = new ColumnValueResult(columnValue.ColumnUId);
                if (!string.IsNullOrWhiteSpace(columnValue.Value?.ToString()))
                {
                    var macroValue = context.MacrosValues
                                     .FirstOrDefault(x => x.Alias == columnValue.Value.ToString()).Value;
                    result.Value = macroValue;
                }
                context.Results.Add(columnValue.ColumnUId, result);
            }
        }
        /// <summary>
        /// Replaces macros with values in columns.
        /// </summary>
        /// <param name="context"></param>
        public override void Process(ColumnValuesIteratorContext context)
        {
            if (!context.MacrosValues.Any())
            {
                return;
            }
            var columnValues = context.ColumnValues.Where(c => c.HasMacrosValue && c.IsTextColumn);

            foreach (var columnValue in columnValues)
            {
                var result = new ColumnValueResult(columnValue.ColumnUId);
                if (!string.IsNullOrWhiteSpace(columnValue.Value?.ToString()))
                {
                    var stringBuilder = new StringBuilder(columnValue.Value.ToString());
                    context.MacrosValues
                    .ForEach(macro => {
                        stringBuilder.Replace(macro.Alias, macro.StringValue);
                    });
                    result.Value = stringBuilder.ToString();
                }
                context.Results.Add(columnValue.ColumnUId, result);
            }
        }