Class EcomProvider
- Namespace
- Dynamicweb.DataIntegration.Providers.EcomProvider
- Assembly
- Dynamicweb.DataIntegration.dll
[AddInName("Dynamicweb.DataIntegration.Providers.Provider")]
[AddInLabel("Ecom Provider")]
[AddInDescription("Ecom provider")]
[AddInIgnore(false)]
public class EcomProvider : BaseSqlProvider, IParameterizedDestination, IParameterOptions, IParameterVisibility, ISource, IDestination, IDisposable
- Inheritance
-
EcomProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
EcomProvider()
public EcomProvider()
EcomProvider(string)
public EcomProvider(string connectionString)
Parameters
connectionStringstring
EcomProvider(XmlNode)
public EcomProvider(XmlNode xmlNode)
Parameters
xmlNodeXmlNode
Properties
Connection
protected SqlConnection Connection { get; set; }
Property Value
CreateMissingGoups
[AddInParameter("Create missing groups")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(43)]
public bool CreateMissingGoups { get; set; }
Property Value
DeactivateMissingProducts
[AddInParameter("Deactivate missing products")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=When ON missing products are deactivated. When OFF no action is taken. When Delete incoming rows is ON, Deactivate missing products is skipped. The Hide deactivated products option is used only when Deactivate missing products is ON")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(30)]
public bool DeactivateMissingProducts { get; set; }
Property Value
DefaultLanguage
[AddInParameter("Default Language")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;Tooltip=Set the default language for the imported products")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(10)]
public string DefaultLanguage { get; set; }
Property Value
DeleteIncomingItems
[AddInParameter("Delete incoming rows")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=Deletes existing rows present in the import source. When Delete incoming rows is ON, the following options are skipped: Update only existing products, Update only existing records, Deactivate missing products, Remove missing rows after import, and Delete products / groups for languages included in input")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(50)]
public bool DeleteIncomingItems { get; set; }
Property Value
DeleteProductsAndGroupForSpecificLanguage
[AddInParameter("Delete products/groups for languages included in input")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=Deletes products and groups only from the languages included in the import. When Delete incoming rows is ON, this option is ignored")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(60)]
public bool DeleteProductsAndGroupForSpecificLanguage { get; set; }
Property Value
DisableCacheClearing
[AddInParameter("Disable cache clearing")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=This setting disables cache clearing after import\t")]
[AddInParameterGroup("Hidden")]
[AddInParameterOrder(90)]
public bool DisableCacheClearing { get; set; }
Property Value
DiscardDuplicates
[AddInParameter("Discard duplicates")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=When ON, duplicate rows are skipped")]
[AddInParameterGroup("Destination")]
public bool DiscardDuplicates { get; set; }
Property Value
GetGroupNamesForProduct
public bool GetGroupNamesForProduct { get; set; }
Property Value
GetGroupNamesForVariantOptions
public bool GetGroupNamesForVariantOptions { get; set; }
Property Value
GetManufacturerNamesForProducts
public bool GetManufacturerNamesForProducts { get; set; }
Property Value
GetRelatedProductGroupsByName
public bool GetRelatedProductGroupsByName { get; set; }
Property Value
GetRelatedProductsByName
public bool GetRelatedProductsByName { get; set; }
Property Value
GetVariantGroupNamesForProduct
public bool GetVariantGroupNamesForProduct { get; set; }
Property Value
GroupsForProductsBy
[AddInParameter("Get groups for products by:")]
[AddInParameterEditor(typeof(RadioParameterEditor), "")]
[AddInParameterGroup("Source")]
public string GroupsForProductsBy { get; set; }
Property Value
GroupsForVariantOptionsBy
[AddInParameter("Get groups for variant options by:")]
[AddInParameterEditor(typeof(RadioParameterEditor), "")]
[AddInParameterGroup("Source")]
public string GroupsForVariantOptionsBy { get; set; }
Property Value
HideDeactivatedProducts
[AddInParameter("Hide deactivated products")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=When Deactivate missing products is ON, this option hides the deactivated products. If Delete incoming rows is ON, Hide deactivated products is skipped. If Deactivate missing products is OFF, Hide deactivated products is skipped")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(80)]
public bool HideDeactivatedProducts { get; set; }
Property Value
IgnoreEmptyCategoryFieldValues
[AddInParameter("Ignore empty category field values")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=When checked, the Ecom provider does not write empty category field values to the database")]
[AddInParameterGroup("Destination")]
public bool IgnoreEmptyCategoryFieldValues { get; set; }
Property Value
InsertOnlyNewRecords
[AddInParameter("Insert only new records")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=Inserts new records present in the source, but does not update existing records")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(23)]
public bool InsertOnlyNewRecords { get; set; }
Property Value
ManufacturerForProductsBy
[AddInParameter("Get manufacturer for products by:")]
[AddInParameterEditor(typeof(RadioParameterEditor), "")]
[AddInParameterGroup("Source")]
public string ManufacturerForProductsBy { get; set; }
Property Value
PartialUpdate
This property is used to remove rows from the EcomGroupProductRelationsTable, but only for the products that are being imported. It can be set in the job settings xml file in the config section
public virtual bool PartialUpdate { get; set; }
Property Value
RelatedProductGroupsBy
[AddInParameter("Get related product groups by:")]
[AddInParameterEditor(typeof(RadioParameterEditor), "")]
[AddInParameterGroup("Source")]
public string RelatedProductGroupsBy { get; set; }
Property Value
RelatedProductsBy
[AddInParameter("Get related products by:")]
[AddInParameterEditor(typeof(RadioParameterEditor), "")]
[AddInParameterGroup("Source")]
public string RelatedProductsBy { get; set; }
Property Value
RemoveMissingAfterImport
[AddInParameter("Remove missing rows after import")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=Removes rows from the destination and relation tables. This option takes precedence")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(40)]
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")]
[AddInParameterOrder(41)]
public bool RemoveMissingRows { get; set; }
Property Value
Shop
[AddInParameter("Shop")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;Tooltip=Set a shop for the imported products")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(20)]
public string Shop { 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 bool SkipFailingRows { get; set; }
Property Value
SourceLanguage
[AddInParameter("Source language")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;Tooltip=Select only products in this language.")]
[AddInParameterGroup("Source")]
public string SourceLanguage { get; set; }
Property Value
SourceShop
[AddInParameter("Source shop")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;Tooltip=Select only products from this shop.")]
[AddInParameterGroup("Source")]
public string SourceShop { get; set; }
Property Value
UpdateOnlyExistingProducts
[AddInParameter("Update only existing products")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(42)]
public bool UpdateOnlyExistingProducts { get; set; }
Property Value
UpdateOnlyExistingRecords
[AddInParameter("Update only existing records")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=When this option is ON the imported rows are updated but not inserted. When OFF rows are updated and inserted")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(25)]
public bool UpdateOnlyExistingRecords { get; set; }
Property Value
UseProductIdFoundByNumber
[AddInParameter("Use existing Product Id found by Number in Variant Products")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=When checked, the values in Dynamicweb ProductId and ProductVariantID will be used at import to update products in Dynamicweb. A product is only updated if it matches the ProductNumber (in default language) of the imported row and if the Dynamicweb ProductVariantId field is not empty")]
[AddInParameterGroup("Destination")]
public bool UseProductIdFoundByNumber { get; set; }
Property Value
UseStrictPrimaryKeyMatching
[AddInParameter("Use strict primary key matching")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=When ON, existing products are matched only on the key columns of the products mapping. When OFF, a product that is not found by the key columns is also looked up by product number and then by product name before a new product is created. The same fallback applies when resolving related products")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(38)]
public bool UseStrictPrimaryKeyMatching { get; set; }
Property Value
UserKeyField
[AddInParameter("User key field")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
[AddInParameterGroup("Hidden")]
public string UserKeyField { get; set; }
Property Value
VariantGroupsForProductsBy
[AddInParameter("Get variant groups for products by:")]
[AddInParameterEditor(typeof(RadioParameterEditor), "")]
[AddInParameterGroup("Source")]
public string VariantGroupsForProductsBy { get; set; }
Property Value
Methods
Close()
Closes the provider when the job has finished, releasing connections and other resources. Called on both the source and the destination provider. Must be overridden; the base implementation throws NotImplementedException.
public override void Close()
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
GetHiddenParameterNames(string, object?)
public IEnumerable<string> GetHiddenParameterNames(string parameterName, object? parameterValue)
Parameters
Returns
GetOriginalDestinationSchema()
Gets the unmodified schema as read from the underlying destination, ignoring any user edits. Used by the job editor to reset or compare schemas. Must be overridden by destination providers; the base implementation throws NotImplementedException.
public override Schema GetOriginalDestinationSchema()
Returns
- Schema
The original destination schema.
GetOriginalSourceSchema()
Gets the unmodified schema as read from the underlying source, ignoring any user edits. Used by the job editor to reset or compare schemas. Must be overridden by source providers; the base implementation throws NotImplementedException.
public override Schema GetOriginalSourceSchema()
Returns
- Schema
The original source schema.
GetParameterOptions(string)
public IEnumerable<ParameterOption> GetParameterOptions(string parameterName)
Parameters
parameterNamestring
Returns
GetReader(Mapping)
Creates a reader that returns the source rows for a table mapping. Called by the destination provider's RunJob(Job) once per active mapping when this provider is the source of the job; the returned reader is drained via IsDone()/GetNext() and disposed afterwards. Must be overridden by source providers; the base implementation throws NotImplementedException.
public override ISourceReader GetReader(Mapping mapping)
Parameters
mappingMappingThe table mapping to read source rows for.
Returns
- ISourceReader
A reader positioned at the first row of the mapped source table.
OrderTablesInJob(Job, bool)
Orders the tables (mappings) for a job in a deterministic sequence required by the Ecom import process.
The import pipeline expects certain tables to be processed before others (for example languages and
countries before product data). This method collects mappings for the tables in the predefined order and
produces a new ordered MappingCollection assigned to job.Mappings.
Notes for maintainers:
- The order of names in Dynamicweb.DataIntegration.Providers.EcomProvider.EcomProvider.TableImportOrder is significant and should reflect dependencies between destination tables. Changing the order may break the import or leave referential data missing.
- The implementation aggregates all mappings with the same table name and preserves their relative order.
- This method is intentionally simple and deterministic; if the ordering logic becomes more complex it may be worth extracting to a dedicated helper to keep cyclomatic complexity low.
public override void OrderTablesInJob(Job job, bool isSource)
Parameters
OverwriteDestinationSchemaToOriginal()
Discards user edits to the destination schema and reverts to GetOriginalDestinationSchema(). Must be overridden by destination providers; the base implementation throws NotImplementedException.
public override void OverwriteDestinationSchemaToOriginal()
OverwriteSourceSchemaToOriginal()
Discards user edits to the source schema and reverts to GetOriginalSourceSchema(). Must be overridden by source providers; the base implementation throws NotImplementedException.
public override void OverwriteSourceSchemaToOriginal()
RunJob(Job)
Executes the job with this provider as the destination. Called once by the job engine; the implementation
loops the active table mappings, reads the rows from job.Source via
GetReader(Mapping), processes each row with
ProcessInputRow(Dictionary<string, object>, Mapping) and writes it to the destination.
Must be overridden by destination providers; the base implementation throws
NotImplementedException.
public override bool RunJob(Job job)
Parameters
jobJobThe job to run.
Returns
Serialize()
Serializes the provider configuration to an XML fragment string, used when the provider settings are stored
as part of a job definition. Must round-trip with the Ctor(XmlNode) constructor. The base
implementation throws NotImplementedException.
public override string Serialize()
Returns
- string
The provider configuration as an XML string.
UpdateDestinationSettings(IDestination)
Copies the settings of another instance of the same provider into this instance, used when the job editor saves updated destination settings onto an existing job. Must be overridden by destination providers; the base implementation throws NotImplementedException.
public override void UpdateDestinationSettings(IDestination destination)
Parameters
destinationIDestinationThe instance holding the new settings; cast to the concrete provider type.
UpdateSourceSettings(ISource)
Copies the settings of another instance of the same provider into this instance, used when the job editor saves updated source settings onto an existing job. Must be overridden by source providers; the base implementation throws NotImplementedException.
public override void UpdateSourceSettings(ISource source)
Parameters
sourceISourceThe instance holding the new settings; cast to the concrete provider type.
ValidateDestinationSettings()
Validates the destination settings. Used to validate properties when created by the AddinSelector.
public override string ValidateDestinationSettings()
Returns
ValidateSourceSettings()
Validates the source settings when the provider is configured as a source in the job editor. Override to check connectivity, file existence and similar; return an error description to show the user, or a non-error string when valid.
public override string ValidateSourceSettings()
Returns
- string
A validation message; the default implementation performs no validation.