Table of Contents

Class BaseSqlReader

Namespace
Dynamicweb.DataIntegration.Integration
Assembly
Dynamicweb.DataIntegration.dll

Reads rows from a SQL-backed source mapping and supports immediate response write-back updates.

public abstract class BaseSqlReader : ISourceReader, IDisposable, IResponseWriter
Inheritance
BaseSqlReader
Implements
Derived
Inherited Members

Constructors

BaseSqlReader()

protected BaseSqlReader()

BaseSqlReader(Mapping, SqlConnection)

public BaseSqlReader(Mapping mapping, SqlConnection connection)

Parameters

mapping Mapping
connection SqlConnection

Fields

_command

protected SqlCommand? _command

Field Value

SqlCommand

_reader

protected SqlDataReader? _reader

Field Value

SqlDataReader

mapping

protected Mapping mapping

Field Value

Mapping

Properties

PkColumnsForResponseMapping

protected IEnumerable<string> PkColumnsForResponseMapping { get; }

Property Value

IEnumerable<string>

Methods

Close()

Closes and disposes the response write-back command and connection.

public void Close()

Dispose()

Disposes the active SQL reader and releases the response write-back resources.

public void Dispose()

GetColumns()

protected virtual string GetColumns()

Returns

string

GetColumnsFromMappingConditions()

protected string GetColumnsFromMappingConditions()

Returns

string

GetColumnsFromMappingConditions(string[])

protected string GetColumnsFromMappingConditions(string[] columnsToSkip)

Parameters

columnsToSkip string[]

Returns

string

GetDistinctColumnsFromMapping()

protected string GetDistinctColumnsFromMapping()

Returns

string

GetDistinctColumnsFromMapping(string[])

protected string GetDistinctColumnsFromMapping(string[] columnsToSkip)

Parameters

columnsToSkip string[]

Returns

string

GetFromTables()

protected virtual string GetFromTables()

Returns

string

GetNext()

Returns the current row from the active SQL reader.

public virtual Dictionary<string, object> GetNext()

Returns

Dictionary<string, object>

The current reader row, or an empty dictionary when no SQL reader has been initialized.

GetPrimaryKeyColumns(bool)

protected IEnumerable<string> GetPrimaryKeyColumns(bool returnOnlyMissedInMappings = true)

Parameters

returnOnlyMissedInMappings bool

Returns

IEnumerable<string>

HandleResponseCommands(IReadOnlyCollection<KeyValuePair<string, Dictionary<string, object?>>>)

Handles response write-back commands either immediately on a dedicated connection or later during Close().

protected virtual void HandleResponseCommands(IReadOnlyCollection<KeyValuePair<string, Dictionary<string, object?>>> responseSqls)

Parameters

responseSqls IReadOnlyCollection<KeyValuePair<string, Dictionary<string, object>>>

The parameterized SQL update commands to execute for the current response rows.

IsDone()

Determines whether the active SQL reader has reached the end of the result set.

public virtual bool IsDone()

Returns

bool

true when no more rows are available; otherwise false.

SetReaderMapping(Mapping)

Applies the mapping used by the reader and refreshes response-mapping metadata derived from it.

protected void SetReaderMapping(Mapping targetMapping)

Parameters

targetMapping Mapping

The mapping that should drive source reads and response write-back behavior.

Write(Dictionary<string, object>)

Writes response-mapped values back to the source table for the current row.

public void Write(Dictionary<string, object> row)

Parameters

row Dictionary<string, object>

The response row containing the destination values that should be written back.

Exceptions

InvalidOperationException

Thrown when response mappings depend on key values that are missing from row, or when fallback key resolution requires an active reader that is not available.

To top