Posted on 15/07/2026 10:05:52
Yes, this is intended.
It is not meant for @Code(SuperExpensiveFunMethod()) - it will break in 10 seconds because, yes - developers cannot help themselves :-).
ScriptTypeProvider is fin - be careful about performance.
I just updated the documentation for ScriptTypeProvider - see below:
Extensibility point for transforming column values during a data integration job. A script type provider is attached to a ColumnMapping, and its GetValue(object) method is called for every row. It receives the source column value and returns the value to write to the destination column.
Built-in implementations include Append, Prepend, Constant, Substring, NewGuid, CurrentTime, and Invert. These can be found in the Dynamicweb.DataIntegration.Integration.ScriptTypes namespace.
How to create a custom provider
Subclass ScriptTypeProvider<TReturnType>, which is preferred because it provides a typed contract, or subclass the base class directly.
Decorate the provider with AddInLabelAttribute to control its display name in the mapping UI. Expose configuration through public properties decorated with AddInParameterAttribute and an appropriate editor attribute.
The class derives from ConfigurableAddIn, so parameters are rendered and persisted automatically. Deploy the assembly with the solution. The provider is then discovered by the add-in system and becomes selectable on column mappings in the data integration job editor.
Things to be careful of
GetValue(object) runs once per row. Keep it fast and allocation-light. Avoid database or network calls for each invocation, and cache expensive lookups.
- The input value may be
null or DBNull. Handle both cases.
- When a provider is assigned to a mapping, its return value bypasses the standard source-to-destination type conversion. The returned object must therefore be compatible with the destination column type.
- Use the
Culture property for culture-sensitive parsing or formatting instead of relying on the current thread culture.
- Instances must be XML-serializable through the
ConfigurableAddIn parameter system. Keep configuration in add-in parameter properties and provide a public, parameterless constructor.
- The context properties
Job, Mapping, SourceColumn, DestinationColumn, and Culture are populated by the framework when the provider is assigned to a mapping. They are null until then, so do not rely on them in the constructor.
Example
The following provider converts string values to uppercase:
using Dynamicweb.Extensibility.AddIns;
using Dynamicweb.Extensibility.Editors;
using Dynamicweb.DataIntegration.Integration;
[AddInLabel("Upper case")]
public class UpperCaseScriptType : ScriptTypeProvider<string>
{
[AddInParameter("TrimValue"),
AddInLabel("Trim value"),
AddInParameterGroup("Scripting"),
AddInParameterEditor(typeof(YesNoParameterEditor), "")]
public bool TrimValue { get; set; }
public override IEnumerable<Type> AllowedTypes { get; set; }
= new[] { typeof(string) };
public override string GetValueTyped(object? input)
{
var value = input?.ToString() ?? string.Empty;
if (TrimValue)
value = value.Trim();
return value.ToUpper(
Culture ?? System.Globalization.CultureInfo.InvariantCulture
);
}
}