diff --git a/src/Dynamicweb.DataIntegration.Providers.OrderProvider.csproj b/src/Dynamicweb.DataIntegration.Providers.OrderProvider.csproj index c4b6d31..82dafe7 100644 --- a/src/Dynamicweb.DataIntegration.Providers.OrderProvider.csproj +++ b/src/Dynamicweb.DataIntegration.Providers.OrderProvider.csproj @@ -1,6 +1,6 @@  - 10.8.4 + 10.9.0 1.0.0.0 Order Provider Order Provider @@ -23,7 +23,7 @@ snupkg - + diff --git a/src/OrderProvider.cs b/src/OrderProvider.cs index 69c544f..2da2e71 100644 --- a/src/OrderProvider.cs +++ b/src/OrderProvider.cs @@ -60,11 +60,18 @@ private SqlConnection Connection set { connection = value; } } + private void InitTableRelations() + { + TableRelations.Clear(); + TableRelations.Add("EcomOrderLines", ["EcomOrders"]); + } + public OrderProvider(string connectionString) { SqlConnectionString = connectionString; Connection = new SqlConnection(connectionString); DiscardDuplicates = false; + InitTableRelations(); } public override void LoadSettings(Job job) @@ -163,6 +170,8 @@ Schema ISource.GetSchema() public OrderProvider(XmlNode xmlNode) { + InitTableRelations(); + foreach (XmlNode node in xmlNode.ChildNodes) { switch (node.Name) @@ -304,38 +313,9 @@ public OrderProvider() public override ISourceReader GetReader(Mapping mapping) { return new OrderSourceReader(mapping, Connection, ExportNotExportedOrders, ExportOnlyOrdersWithoutExtID, DoNotExportCarts); - } - - public override void OrderTablesInJob(Job job, bool isSourceLookup) - { - MappingCollection tables = new MappingCollection(); - - var mappings = GetMappingsByName(job.Mappings, "EcomOrders", isSourceLookup); - if (mappings != null) - { - tables.AddRange(mappings); - } + } - mappings = GetMappingsByName(job.Mappings, "EcomOrderLines", isSourceLookup); - if (mappings != null) - { - tables.AddRange(mappings); - } - - mappings = GetMappingsByName(job.Mappings, "EcomOrderLineFields", isSourceLookup); - if (mappings != null) - { - tables.AddRange(mappings); - } - - mappings = GetMappingsByName(job.Mappings, "EcomOrderLineFieldGroupRelation", isSourceLookup); - if (mappings != null) - { - tables.AddRange(mappings); - } - - job.Mappings = tables; - } + public override void OrderTablesInJob(Job job, bool isSource) => OrderTablesByRelations(job, isSource); internal static List GetMappingsByName(MappingCollection collection, string name, bool isSourceLookup) {