Table of Contents

Class BaseProvider

Namespace
Dynamicweb.DataIntegration
Assembly
Dynamicweb.DataIntegration.dll

Provides base functionality for source-destination data integration means. Any providers for integration MUST provide three constructors of types: Ctor(), Ctor(string filename) & Ctor(XmlNode xmlNode) as these are all called implicitly through reflection in the frontend and in the Job class.

[AddInName("Dynamicweb.DataIntegration.Providers.Provider")]
[AddInDescription("Base provider")]
public abstract class BaseProvider : ConfigurableAddIn, ISource, IDestination, IParameterizedDestination
Inheritance
BaseProvider
Implements
Derived
Inherited Members
Extension Methods

Properties

ABasePovider

protected BaseProvider ABasePovider { get; set; }

Property Value

BaseProvider

FilesFolderName

The Name of the files folder in the current installation of Dynamicweb. Empty if used for test.

public string FilesFolderName { get; set; }

Property Value

string

JobIsGoingToRun

Gets and sets "job is going to run" status

public bool JobIsGoingToRun { get; set; }

Property Value

bool

Logger

Optional logger instance. Implementations should use this for consistent logging.

public ILogger? Logger { get; set; }

Property Value

ILogger

Parameters

Parameters

public Dictionary<string, string> Parameters { get; set; }

Property Value

Dictionary<string, string>

SchemaIsEditable

Schema is editable

public virtual bool SchemaIsEditable { get; }

Property Value

bool

TableRelations

protected Dictionary<string, List<string>> TableRelations { get; }

Property Value

Dictionary<string, List<string>>

WorkingDirectory

Gets and sets working directory path

public virtual string WorkingDirectory { get; set; }

Property Value

string

Methods

CheckCondition(MappingConditional, Dictionary<string, object>)

Checks mapping conditionals

public bool CheckCondition(MappingConditional mappingConditional, Dictionary<string, object> row)

Parameters

mappingConditional MappingConditional

MappingConditionals

row Dictionary<string, object>

Returns

bool

Result of check

Close()

Close the provider and release resources (connections, file handles, etc.). Should be safe to call multiple times (idempotent).

public virtual void Close()

CreateParameterNode(Type, string, string?)

protected static XElement? CreateParameterNode(Type type, string name, string? value)

Parameters

type Type
name string
value string

Returns

XElement

GetDefaultValue(Type?)

Gets the default value for the type

public static object? GetDefaultValue(Type? type)

Parameters

type Type

Returns

object

GetDetails(string)

Return optional provider details to be stored alongside persisted schema metadata.

public virtual string? GetDetails(string id)

Parameters

id string

Returns

string

GetFailedSourceRowMessage(Dictionary<string, object>?)

Gets the failed row data message

public static string GetFailedSourceRowMessage(Dictionary<string, object>? row)

Parameters

row Dictionary<string, object>

Data row

Returns

string

The failed row data as string

GetId()

Return a stable identifier for this provider instance when available. Used by JobSchemaService to persist per-provider schema files.

public virtual string? GetId()

Returns

string

GetOriginalDestinationSchema()

Gets the schema from the Destination Source

public virtual Schema GetOriginalDestinationSchema()

Returns

Schema

GetOriginalSourceSchema()

Fetch the most recent schema directly from the source (unmodified, live).

This should return a fresh representation of the source structure and may perform expensive I/O. Use it when you explicitly need the authoritative source schema regardless of any cached/persisted schema.

public virtual Schema GetOriginalSourceSchema()

Returns

Schema

A fresh Schema from the source.

GetReader(Mapping)

Create and return an ISourceReader for the provided mapping.

The returned reader must be initialized and ready to enumerate rows for the mapping. Implementations are responsible for any resource allocation; callers will close the reader.

public virtual ISourceReader GetReader(Mapping mapping)

Parameters

mapping Mapping

Mapping that configures what/how to read.

Returns

ISourceReader

An ISourceReader instance.

GetSchema()

Return the live Schema (tables + columns) for this source.

Implementer guidance:

  • Return a thread-safe, non-mutating Schema instance (or a defensive copy).
  • Prefer cached or lightweight responses to avoid repeated expensive I/O.
  • This method should reflect the source structure at the time of the call.

Note: schema access is centralized via GetSchema(ISource?). That service consults the SchemaManagementFeature and may use a persisted schema instead of invoking this method. Call this directly only when you need the live schema.

public virtual Schema GetSchema()

Returns

Schema

The source Schema describing tables and columns.

Initialize()

Initialize the provider. Open transient resources (connections) required for operation.

Avoid heavy or long-running operations here when possible; prefer lazy initialization where appropriate.

public virtual void Initialize()

IsSortable(Job, bool)

public virtual bool IsSortable(Job job, bool isSource)

Parameters

job Job
isSource bool

Returns

bool

LoadSettings(Job)

Apply runtime settings from the job prior to execution.

Called when a job runs and allows the provider to adjust settings from the job context before any reading/writing occurs.

public virtual void LoadSettings(Job job)

Parameters

job Job

Job containing runtime settings and context.

OrderTablesByRelations(Job, bool)

public void OrderTablesByRelations(Job job, bool isSource)

Parameters

job Job
isSource bool

OverwriteDestinationSchemaToOriginal()

Replace the destination's current/cached schema with the latest schema from the destination.

Implementations should update any internal schema cache/state so subsequent calls to GetSchema() reflect the original schema returned by GetOriginalDestinationSchema().

public virtual void OverwriteDestinationSchemaToOriginal()

OverwriteSourceSchemaToOriginal()

Replace the provider's current/cached schema with the latest schema from the source.

Implementations should update any internal schema cache/state so subsequent calls to GetSchema() reflect the original schema returned by GetOriginalSourceSchema().

public virtual void OverwriteSourceSchemaToOriginal()

ProcessInputRow(Dictionary<string, object>, Mapping)

Processes the source row using the provider from table mapping script class

protected bool ProcessInputRow(Dictionary<string, object> row, Mapping mapping)

Parameters

row Dictionary<string, object>

source row

mapping Mapping

mapping

Returns

bool

ReplaceMappingConditionalsWithValuesFromRequest(Job)

protected void ReplaceMappingConditionalsWithValuesFromRequest(Job job)

Parameters

job Job

RunJob(Job)

Execute the job against this destination. The implementation performs the write/insert/update operations required by the job and returns true on success.

Implementations should be robust: validate inputs, log errors, and leave destination in a consistent state or perform appropriate rollback where applicable.

public virtual bool RunJob(Job job)

Parameters

job Job

Job to execute.

Returns

bool

True if the job completed successfully; otherwise false.

SaveAsXml(XmlTextWriter)

Persist provider settings to the supplied System.Xml.XmlTextWriter.

Implementations should write their configuration elements but must not close or dispose the writer.

public virtual void SaveAsXml(XmlTextWriter textWriter)

Parameters

textWriter XmlTextWriter

Xml writer to write settings into.

Serialize()

Serialize provider settings for use by AddinSelectors.

Output must be of the format <xxx>yyy</xxx>, where xxx is the parameter name (as defined by the decoration) and yyy is the value.

public virtual string Serialize()

Returns

string

XML fragment describing configured addin parameters.

UpdateDestinationSettings(IDestination)

Update this instance's settings to match the provided destination.

Used to copy settings between provider instances (for example when restoring from saved configuration).

public virtual void UpdateDestinationSettings(IDestination destination)

Parameters

destination IDestination

Destination instance to copy settings from.

UpdateIndexes(IList<string>, ILogger?)

public static void UpdateIndexes(IList<string> indexes, ILogger? logger)

Parameters

indexes IList<string>
logger ILogger

UpdateSourceSettings(ISource)

Update this instance's settings to match the provided source.

Used to copy settings between provider instances (for example when restoring from saved configuration).

public virtual void UpdateSourceSettings(ISource source)

Parameters

source ISource

Source instance to copy settings from.

ValidateDestinationSettings()

Validates the destination settings. Used to validate properties when created by the AddinSelector.

public virtual string ValidateDestinationSettings()

Returns

string

ValidateSourceSettings()

Validate the source configuration.

Return an empty string for a valid configuration; otherwise return a human-readable error/validation message describing the problem.

public virtual string ValidateSourceSettings()

Returns

string

Empty string if valid; otherwise a validation error message.

See Also

To top