Skip to content

Commit

Permalink
Merge pull request #16 from dynamicweb/mss/GetSqlSourceSchema-RollBack
Browse files Browse the repository at this point in the history
Rollback new logic for GetSqlSourceSchema and bump version to 10.0.9
  • Loading branch information
frederik5480 authored Nov 2, 2023
2 parents 2c4454f + 47f8f8b commit c3b07c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.0.8</Version>
<Version>10.0.9</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Ecom Provider</Title>
<Description>Ecom Provider</Description>
Expand Down
27 changes: 16 additions & 11 deletions src/EcomProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
using Dynamicweb.DataIntegration.Integration;
using Dynamicweb.DataIntegration.Integration.Interfaces;
using Dynamicweb.DataIntegration.ProviderHelpers;
using Dynamicweb.Environment;
using Dynamicweb.Extensibility;
using Dynamicweb.Extensibility.AddIns;
using Dynamicweb.Extensibility.Editors;
using Dynamicweb.Indexing;
using Dynamicweb.Indexing.Repositories;
using Dynamicweb.Logging;
using Microsoft.CodeAnalysis;
using System;
Expand Down Expand Up @@ -97,9 +93,9 @@ public string RelatedProductGroupsBy
}

public bool GetRelatedProductGroupsByName { get; set; }

private string defaultLanguage = null;
[AddInParameter("Default Language"), AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;Tooltip=Set the default language for the imported products"), AddInParameterGroup("Destination"), AddInParameterOrder(10)]
[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
Expand Down Expand Up @@ -213,9 +209,9 @@ public override Schema GetOriginalSourceSchema()
return GetSchema(false);
}

private Schema GetDynamicwebSourceSchema(IEnumerable<string> tableNames)
private Schema GetDynamicwebSourceSchema()
{
Schema result = GetSqlSourceSchema(Connection, tableNames);
Schema result = GetSqlSourceSchema(Connection);
//set key for AccessUserTable
if (UserKeyField != null)
{
Expand Down Expand Up @@ -264,12 +260,21 @@ private Schema GetDynamicwebSourceSchema(IEnumerable<string> tableNames)
/// <returns></returns>
public Schema GetSchema(bool getForDestination)
{
Schema result = GetDynamicwebSourceSchema();
List<string> tablestToKeep = new()
{ "EcomProducts", "EcomManufacturers", "EcomGroups", "EcomVariantGroups", "EcomVariantsOptions",
"EcomProductsRelated", "EcomProductItems", "EcomStockUnit", "EcomDetails","EcomProductCategoryFieldValue", "EcomLanguages", "EcomPrices",
"EcomAssortmentGroupRelations", "EcomAssortmentPermissions", "EcomAssortmentProductRelations", "EcomAssortments", "EcomAssortmentShopRelations", "EcomVariantOptionsProductRelation"};
Schema result = GetDynamicwebSourceSchema(tablestToKeep);

List<Table> tablesToRemove = new();
foreach (Table table in result.GetTables())
{
if (!tablestToKeep.Contains(table.Name))
tablesToRemove.Add(table);
}
foreach (Table table in tablesToRemove)
{
result.RemoveTable(table);
}
foreach (Table table in result.GetTables())
{
switch (table.Name)
Expand Down Expand Up @@ -957,7 +962,7 @@ private IEnumerable<ParameterOption> GetDefaultLanguageOptions()
var sqlCommand = GetOpenConnection();
var languagesDataAdapter = new SqlDataAdapter("SELECT LanguageID, LanguageCode2, LanguageName FROM EcomLanguages", sqlCommand.Connection);
_ = new SqlCommandBuilder(languagesDataAdapter);
var languageDataSet = new DataSet();
var languageDataSet = new DataSet();
languagesDataAdapter.Fill(languageDataSet);
foreach (DataRow row in languageDataSet.Tables[0].Rows)
{
Expand Down

0 comments on commit c3b07c2

Please sign in to comment.