Class SqlProvider
- Namespace
- Dynamicweb.DataIntegration.Providers.SqlProvider
- Assembly
- Dynamicweb.DataIntegration.dll
[AddInName("Dynamicweb.DataIntegration.Providers.Provider")]
[AddInLabel("SQL Provider")]
[AddInDescription("SQL provider")]
[AddInIgnore(false)]
public class SqlProvider : BaseSqlProvider, IParameterizedDestination, ISource, IDestination, IDisposable
- Inheritance
-
SqlProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
SqlProvider()
public SqlProvider()
SqlProvider(string)
public SqlProvider(string connectionString)
Parameters
connectionStringstring
SqlProvider(XmlNode)
public SqlProvider(XmlNode xmlNode)
Parameters
xmlNodeXmlNode
Properties
Catalog
protected string? Catalog { get; set; }
Property Value
Connection
protected SqlConnection Connection { get; set; }
Property Value
DestinationConnectionString
[AddInParameter("Sql destination connection string")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
[AddInParameterGroup("Destination")]
public string? DestinationConnectionString { get; set; }
Property Value
DestinationDatabase
[AddInParameter("Sql destination database")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
[AddInParameterGroup("Destination")]
public string? DestinationDatabase { get; set; }
Property Value
DestinationPassword
[AddInParameter("Sql destination server password")]
[AddInParameterEditor(typeof(TextParameterEditor), "password=true")]
[AddInParameterGroup("Destination")]
public string? DestinationPassword { get; set; }
Property Value
DestinationServer
[AddInParameter("Destination server")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
[AddInParameterGroup("Destination")]
public string? DestinationServer { get; set; }
Property Value
DestinationServerSSPI
[AddInParameter("Use integrated security to connect to destination server")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "")]
[AddInParameterGroup("Destination")]
public bool DestinationServerSSPI { get; set; }
Property Value
DestinationUsername
[AddInParameter("Sql destination server username")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
[AddInParameterGroup("Destination")]
public string? DestinationUsername { get; set; }
Property Value
DiscardDuplicates
[AddInParameter("Discard duplicates")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=When ON, duplicate rows are skipped")]
[AddInParameterGroup("Destination")]
public virtual bool DiscardDuplicates { get; set; }
Property Value
ManualConnectionString
protected string? ManualConnectionString { get; set; }
Property Value
Password
protected string? Password { get; set; }
Property Value
RemoveMissingAfterImport
[AddInParameter("Remove missing rows after import")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=Deletes rows from each destination table individually, based on whether they are present in the corresponding source table. This setting looks at each table separately and removes rows missing from the source for that specific table. This option takes precedence")]
[AddInParameterGroup("Destination")]
public bool RemoveMissingAfterImport { get; set; }
Property Value
RemoveMissingAfterImportDestinationTablesOnly
[AddInParameter("Remove missing rows after import in the destination tables only")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=Deletes rows not present in the import source - excluding related tabled")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(35)]
public bool RemoveMissingAfterImportDestinationTablesOnly { get; set; }
Property Value
RemoveMissingRows
[AddInParameter("Remove missing rows across all tables after import")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=Deletes rows from all destination tables and relation tables by considering the entire dataset in the import source. This setting evaluates all tables collectively and removes rows missing across the whole activity.")]
[AddInParameterGroup("Destination")]
public bool RemoveMissingRows { get; set; }
Property Value
Server
protected string? Server { get; set; }
Property Value
SkipFailingRows
[AddInParameter("Persist successful rows and skip failing rows")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=Checking this box allows the activity to do partial imports by skipping problematic records and keeping the succesful ones")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(100)]
public virtual bool SkipFailingRows { get; set; }
Property Value
SourceConnectionString
[AddInParameter("Sql source connection string")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
[AddInParameterGroup("Source")]
public string? SourceConnectionString { get; set; }
Property Value
SourceDatabase
[AddInParameter("Sql source database")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
[AddInParameterGroup("Source")]
public string? SourceDatabase { get; set; }
Property Value
SourcePassword
[AddInParameter("Sql source server password")]
[AddInParameterEditor(typeof(TextParameterEditor), "password=true")]
[AddInParameterGroup("Source")]
public string? SourcePassword { get; set; }
Property Value
SourceServer
[AddInParameter("Source server")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
[AddInParameterGroup("Source")]
public string? SourceServer { get; set; }
Property Value
SourceServerSSPI
[AddInParameter("Use integrated security to connect to source server")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "")]
[AddInParameterGroup("Source")]
public bool SourceServerSSPI { get; set; }
Property Value
SourceUsername
[AddInParameter("Sql source server username")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
[AddInParameterGroup("Source")]
public string? SourceUsername { get; set; }
Property Value
SqlConnectionString
protected string SqlConnectionString { get; set; }
Property Value
Transaction
public SqlTransaction Transaction { get; }
Property Value
Username
protected string? Username { get; set; }
Property Value
Methods
CheckMapping(Mapping)
Validate the provided mapping against this destination's schema and capabilities.
public List<SchemaComparerResult> CheckMapping(Mapping map)
Parameters
mapMappingMapping to validate.
Returns
- List<SchemaComparerResult>
Collection of SchemaComparerResult describing issues or an empty list if valid.
Close()
Close the provider and release resources (connections, file handles, etc.). Should be safe to call multiple times (idempotent).
public void Close()
CommitTransaction()
protected void CommitTransaction()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
GetOriginalDestinationSchema()
Gets the schema from the Destination Source
public override Schema GetOriginalDestinationSchema()
Returns
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
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 ISourceReader GetReader(Mapping mapping)
Parameters
mappingMappingMapping 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
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 override void LoadSettings(Job job)
Parameters
jobJobJob containing runtime settings and context.
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 override 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 override void OverwriteSourceSchemaToOriginal()
RollbackTransaction()
protected void RollbackTransaction()
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 override bool RunJob(Job job)
Parameters
jobJobJob 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
textWriterXmlTextWriterXml 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 override 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 override void UpdateDestinationSettings(IDestination destination)
Parameters
destinationIDestinationDestination instance to copy settings from.
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 override void UpdateSourceSettings(ISource source)
Parameters
sourceISourceSource instance to copy settings from.
ValidateDestinationSettings()
Validates the destination settings. Used to validate properties when created by the AddinSelector.
public override string ValidateDestinationSettings()
Returns
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 override string ValidateSourceSettings()
Returns
- string
Empty string if valid; otherwise a validation error message.