Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed local ReplaceKeyColumnsWithAutoIdIfExists and replaced call t… #55

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.7.1</Version>
<Version>10.8.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Ecom Provider</Title>
<Description>Ecom Provider</Description>
Expand All @@ -24,8 +24,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dynamicweb.DataIntegration" Version="10.7.0" />
<PackageReference Include="Dynamicweb.Ecommerce" Version="10.7.0" />
<PackageReference Include="Dynamicweb.DataIntegration" Version="10.8.0" />
<PackageReference Include="Dynamicweb.Ecommerce" Version="10.8.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
</Project>
20 changes: 1 addition & 19 deletions src/EcomProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@
case "RepositoriesIndexUpdate":
if (node.HasChildNodes)
{
RepositoriesIndexUpdate = node.FirstChild?.Value ?? "";

Check warning on line 602 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'EcomProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'

Check warning on line 602 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'EcomProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
}
break;
case "DeleteProductsAndGroupForSpecificLanguage":
Expand Down Expand Up @@ -699,7 +699,7 @@
xmlTextWriter.WriteElementString("DefaultLanguage", DefaultLanguage);
xmlTextWriter.WriteElementString("UpdateOnlyExistingProducts", UpdateOnlyExistingProducts.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("UseStrictPrimaryKeyMatching", UseStrictPrimaryKeyMatching.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("RepositoriesIndexUpdate", RepositoriesIndexUpdate);

Check warning on line 702 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'EcomProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
xmlTextWriter.WriteElementString("UpdateOnlyExistingRecords", UpdateOnlyExistingRecords.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("DeleteIncomingItems", DeleteIncomingItems.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("DiscardDuplicates", DiscardDuplicates.ToString(CultureInfo.CurrentCulture));
Expand Down Expand Up @@ -909,24 +909,6 @@
}
}

private static IEnumerable<ColumnMapping> ReplaceKeyColumnsWithAutoIdIfExists(Mapping mapping)
{
//will move this to MappingExtensions - US https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/20900
if (mapping == null) return [];

var autoIdDestinationColumnName = MappingExtensions.GetAutoIdColumnName(mapping.DestinationTable?.Name ?? "");
if (string.IsNullOrEmpty(autoIdDestinationColumnName)) return mapping.GetColumnMappings();

var columnMappings = mapping.GetColumnMappings().ToList();
var autoIdColumnMapping = columnMappings.Where(obj => obj.DestinationColumn.Name.Equals(autoIdDestinationColumnName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (autoIdColumnMapping != null)
{
columnMappings.ForEach(obj => obj.IsKey = false);
autoIdColumnMapping.IsKey = true;
}
return columnMappings;
}

public override bool RunJob(Job job)
{
ReplaceMappingConditionalsWithValuesFromRequest(job);
Expand Down Expand Up @@ -963,7 +945,7 @@

foreach (Mapping mapping in job.Mappings)
{
var columnMappings = ReplaceKeyColumnsWithAutoIdIfExists(mapping);
var columnMappings = MappingExtensions.ReplaceKeyColumnsWithAutoIdIfExists(mapping);

if (mapping.Active && columnMappings.Any())
{
Expand Down Expand Up @@ -1078,15 +1060,15 @@

private void MoveRepositoriesIndexToJob(Job job)
{
if (!string.IsNullOrEmpty(RepositoriesIndexUpdate))

Check warning on line 1063 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'EcomProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
{
char[] separator = [','];
// if the provider already have RepositoriesIndexUpdate set, then we move them to the job, and set the add-in to string.empty
if (job.RepositoriesIndexSettings?.RepositoriesIndexes?.Count == 0)
{
job.RepositoriesIndexSettings = new RepositoriesIndexSettings(new Collection<string>([.. RepositoriesIndexUpdate.Split(separator, StringSplitOptions.RemoveEmptyEntries)]));

Check warning on line 1069 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'EcomProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
}
RepositoriesIndexUpdate = string.Empty;

Check warning on line 1071 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'EcomProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
job.Save();
}
}
Expand Down Expand Up @@ -1127,7 +1109,7 @@
languagesDataAdapter.Fill(dataSet);
foreach (DataRow row in dataSet.Tables[0].Rows)
{
options.Add(new(row["ShopName"].ToString(), row["shopID"]));

Check warning on line 1112 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

Possible null reference argument for parameter 'label' in 'ParameterOption.ParameterOption(string label, object value)'.
}
return options;
}
Expand All @@ -1142,7 +1124,7 @@
languagesDataAdapter.Fill(languageDataSet);
foreach (DataRow row in languageDataSet.Tables[0].Rows)
{
options.Add(new(row["LanguageName"].ToString(), row["LanguageID"]));

Check warning on line 1127 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

Possible null reference argument for parameter 'label' in 'ParameterOption.ParameterOption(string label, object value)'.
}
return options;
}
Expand All @@ -1156,7 +1138,7 @@
}


IEnumerable<string> IParameterVisibility.GetHiddenParameterNames(string parameterName, object parameterValue)

Check warning on line 1141 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

Nullability of reference types in type of parameter 'parameterValue' doesn't match implemented member 'IEnumerable<string> IParameterVisibility.GetHiddenParameterNames(string parameterName, object? parameterValue)' (possibly because of nullability attributes).

Check warning on line 1141 in src/EcomProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

Nullability of reference types in type of parameter 'parameterValue' doesn't match implemented member 'IEnumerable<string> IParameterVisibility.GetHiddenParameterNames(string parameterName, object? parameterValue)' (possibly because of nullability attributes).
{
var result = new List<string>();
switch (parameterName)
Expand Down
Loading