Skip to content

Commit

Permalink
* Target .NET8
Browse files Browse the repository at this point in the history
* Package upgrades
  • Loading branch information
Valdis Iljuconoks committed Nov 18, 2024
1 parent b97ff34 commit 6038948
Show file tree
Hide file tree
Showing 44 changed files with 118 additions and 203 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

All notable changes to this project will be documented in this file.

## [3.0.2]
## [4.0.0]

* Target .NET8
* Package upgrades

## [4.0.0]

* Added command execution timeout configuration option for EF Core DbContext

Expand Down
3 changes: 3 additions & 0 deletions Geta.Optimizely.ProductFeed.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Enricher/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Enrichers/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\dependencies.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<RazorCompileOnBuild>true</RazorCompileOnBuild>
</PropertyGroup>
<ItemGroup>
<None Include="wwwroot\**\*.*" />
<EmbeddedResource Include="lang\**\*" />
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="EPiServer.Commerce" Version="14.12.0" />
<PackageReference Include="EPiServer.Personalization.Commerce" Version="4.1.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="CsvHelper" Version="33.0.1" />
<PackageReference Include="EPiServer.Commerce" Version="14.30.0" />
<PackageReference Include="EPiServer.Personalization.Commerce" Version="4.1.27" />
<PackageReference Include="Serilog" Version="4.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="Adyen" Version="5.7.0" />
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
</ItemGroup>
<ItemGroup>
<Content Remove="wwwroot\js\js\adyen.js" />
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 1 addition & 3 deletions src/Geta.Optimizely.ProductFeed.Csv/CsvFeedDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

namespace Geta.Optimizely.ProductFeed.Csv;

public class CsvFeedDescriptor<TEntity> : FeedDescriptor
public class CsvFeedDescriptor<TEntity>() : FeedDescriptor("csv", "csv-feed", "text/plain")
{
public CsvFeedDescriptor() : base("csv", "csv-feed", "text/plain") { }

public Type CsvEntityType { get; set; }

public CsvFeedDescriptor<TEntity> SetConverter<TConverter>() where TConverter : IProductFeedConverter<TEntity>
Expand Down
12 changes: 3 additions & 9 deletions src/Geta.Optimizely.ProductFeed.Csv/CsvFeedExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,15 @@

namespace Geta.Optimizely.ProductFeed.Csv;

public class CsvFeedExporter<TEntity> : AbstractFeedContentExporter<TEntity>
public class CsvFeedExporter<TEntity>(CsvFeedDescriptor<TEntity> descriptor) : AbstractFeedContentExporter<TEntity>
{
private readonly CsvFeedDescriptor<TEntity> _descriptor;
private CsvWriter _writer;

public CsvFeedExporter(CsvFeedDescriptor<TEntity> descriptor)
{
_descriptor = descriptor;
}

public override void BeginExport(HostDefinition host, CancellationToken cancellationToken)
{
base.BeginExport(host, cancellationToken);
_writer = new CsvWriter(new StreamWriter(_buffer), new CsvConfiguration(CultureInfo.InvariantCulture));
_writer.WriteHeader(_descriptor.CsvEntityType);
_writer.WriteHeader(descriptor.CsvEntityType);
_writer.NextRecord();
}

Expand All @@ -41,7 +35,7 @@ public override byte[] SerializeEntry(object value, CancellationToken cancellati
_writer.WriteRecord(value);
_writer.NextRecord();

return Array.Empty<byte>();
return [];
}

public override ICollection<FeedEntity> FinishExport(HostDefinition host, CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2</Version>
<PackageVersion>3.0.2</PackageVersion>
<TargetFramework>net8.0</TargetFramework>
<Version>4.0.0</Version>
<PackageVersion>4.0.0</PackageVersion>
<PackageId>Geta.Optimizely.ProductFeed.Csv</PackageId>
<Title>Geta Optimizely Csv Product Feed ProductFeed</Title>
<IsPackable>true</IsPackable>
Expand All @@ -25,10 +25,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="EPiServer.Commerce.Core" Version="14.12.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
<PackageReference Include="CsvHelper" Version="33.0.1" />
<PackageReference Include="EPiServer.Commerce.Core" Version="14.30.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -19,11 +19,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.6">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 2 additions & 7 deletions src/Geta.Optimizely.ProductFeed.Google/EncodedStringWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@

namespace Geta.Optimizely.ProductFeed.Google;

public sealed class EncodedStringWriter : StringWriter
public sealed class EncodedStringWriter(Encoding encoding) : StringWriter
{
public EncodedStringWriter(Encoding encoding)
{
Encoding = encoding;
}

public override Encoding Encoding { get; }
public override Encoding Encoding { get; } = encoding;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2</Version>
<PackageVersion>3.0.2</PackageVersion>
<TargetFramework>net8.0</TargetFramework>
<Version>4.0.0</Version>
<PackageVersion>4.0.0</PackageVersion>
<PackageId>Geta.Optimizely.ProductFeed.Google</PackageId>
<Title>Geta Optimizely Google Product Feed ProductFeed</Title>
<IsPackable>true</IsPackable>
Expand All @@ -25,9 +25,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EPiServer.Commerce.Core" Version="14.12.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
<PackageReference Include="EPiServer.Commerce.Core" Version="14.30.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

namespace Geta.Optimizely.ProductFeed.Google;

public class GoogleFeedDescriptor<TEntity> : FeedDescriptor
public class GoogleFeedDescriptor<TEntity>() : FeedDescriptor("google", "/googleproductfeed", "application/xml")
{
public GoogleFeedDescriptor() : base("google", "/googleproductfeed", "application/xml") { }

public GoogleFeedDescriptor<TEntity> SetConverter<TConverter>() where TConverter : IProductFeedConverter<TEntity>
{
Converter = typeof(TConverter);
Expand Down
8 changes: 4 additions & 4 deletions src/Geta.Optimizely.ProductFeed.Google/GoogleFeedExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public override ICollection<FeedEntity> FinishExport(HostDefinition host, Cancel
Entries = _entries.Where(e => e != null).ToList()
};

return new[]
{
return
[
new FeedEntity
{
CreatedUtc = f.Updated, Link = f.Link, FeedBytes = ObjectXmlSerializer.Serialize(f, typeof(Feed))
}
};
];
}

public override object ConvertEntry(TEntity entity, HostDefinition host, CancellationToken cancellationToken)
Expand All @@ -54,6 +54,6 @@ public override object ConvertEntry(TEntity entity, HostDefinition host, Cancell

public override byte[] SerializeEntry(object value, CancellationToken cancellationToken)
{
return Array.Empty<byte>();
return [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ public virtual void BuildEntry(TEntity entity, HostDefinition host, Cancellation

public virtual ICollection<FeedEntity> FinishExport(HostDefinition host, CancellationToken cancellationToken)
{
return new[]
{
return
[
new FeedEntity
{
CreatedUtc = DateTime.UtcNow,
Link = $"{host.Url.ToString().TrimEnd('/')}/{Descriptor.FileName.TrimStart('/')}",
FeedBytes = _buffer.ToArray()
}
};
];
}

public void SetConverter(IProductFeedConverter<TEntity> converter)
Expand Down
15 changes: 4 additions & 11 deletions src/Geta.Optimizely.ProductFeed/Configuration/FeedDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@

namespace Geta.Optimizely.ProductFeed.Configuration;

public class FeedDescriptor
public class FeedDescriptor(string name, string fileName, string mimeType)
{
public FeedDescriptor(string name, string fileName, string mimeType)
{
Name = name;
FileName = fileName;
MimeType = mimeType;
}

public string Name { get; set; }
public string Name { get; set; } = name;

public string FileName { get; set; }
public string FileName { get; set; } = fileName;

public string MimeType { get; set; }
public string MimeType { get; set; } = mimeType;

public Type Exporter { get; set; }

Expand Down
26 changes: 8 additions & 18 deletions src/Geta.Optimizely.ProductFeed/DefaultProductFeedContentLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,23 @@

namespace Geta.Optimizely.ProductFeed;

public class DefaultProductFeedContentLoader : IProductFeedContentLoader
public class DefaultProductFeedContentLoader(
IContentLoader contentLoader,
ReferenceConverter referenceConverter,
IContentLanguageAccessor languageAccessor)
: IProductFeedContentLoader
{
private readonly IContentLoader _contentLoader;
private readonly IContentLanguageAccessor _languageAccessor;
private readonly ReferenceConverter _referenceConverter;

public DefaultProductFeedContentLoader(
IContentLoader contentLoader,
ReferenceConverter referenceConverter,
IContentLanguageAccessor languageAccessor)
{
_contentLoader = contentLoader;
_referenceConverter = referenceConverter;
_languageAccessor = languageAccessor;
}

public IEnumerable<CatalogContentBase> LoadSourceData(CancellationToken cancellationToken)
{
var catalogReferences = _contentLoader.GetDescendents(_referenceConverter.GetRootLink());
var items = _contentLoader.GetItems(catalogReferences, CreateDefaultLoadOption()).OfType<CatalogContentBase>();
var catalogReferences = contentLoader.GetDescendents(referenceConverter.GetRootLink());
var items = contentLoader.GetItems(catalogReferences, CreateDefaultLoadOption()).OfType<CatalogContentBase>();

return items;
}

private LoaderOptions CreateDefaultLoadOption()
{
var loaderOptions = new LoaderOptions { LanguageLoaderOption.FallbackWithMaster(_languageAccessor.Language) };
var loaderOptions = new LoaderOptions { LanguageLoaderOption.FallbackWithMaster(languageAccessor.Language) };

return loaderOptions;
}
Expand Down
9 changes: 2 additions & 7 deletions src/Geta.Optimizely.ProductFeed/DefaultSiteUrlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@

namespace Geta.Optimizely.ProductFeed;

public class DefaultSiteUrlBuilder : ISiteUrlBuilder
public class DefaultSiteUrlBuilder(ISiteDefinitionRepository siteDefinitionRepository) : ISiteUrlBuilder
{
private readonly string _siteUrl;

public DefaultSiteUrlBuilder(ISiteDefinitionRepository siteDefinitionRepository)
{
_siteUrl = siteDefinitionRepository.List().FirstOrDefault()?.SiteUrl.ToString();
}
private readonly string _siteUrl = siteDefinitionRepository.List().FirstOrDefault()?.SiteUrl.ToString();

public string BuildUrl()
{
Expand Down
3 changes: 2 additions & 1 deletion src/Geta.Optimizely.ProductFeed/FeedBuilderCreateJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override string Execute()

if (mi != null)
{
mi.Invoke(genericPipeline, new object[] { _jobStatusLogger, _cts.Token });
mi.Invoke(genericPipeline, [_jobStatusLogger, _cts.Token]);
}
}
catch (Exception ex)
Expand All @@ -61,5 +61,6 @@ public override string Execute()
public override void Stop()
{
_cts.Cancel();
_cts.Dispose();
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2</Version>
<PackageVersion>3.0.2</PackageVersion>
<TargetFramework>net8.0</TargetFramework>
<Version>4.0.0</Version>
<PackageVersion>4.0.0</PackageVersion>
<PackageId>Geta.Optimizely.ProductFeed</PackageId>
<Title>Geta Optimizely Product Feed ProductFeed</Title>
<IsPackable>true</IsPackable>
Expand All @@ -25,9 +25,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EPiServer.Commerce.Core" Version="14.12.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
<PackageReference Include="EPiServer.Commerce.Core" Version="14.30.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 2 additions & 9 deletions src/Geta.Optimizely.ProductFeed/ISiteBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@ public interface ISiteBuilder
IEnumerable<HostDefinition> GetHosts();
}

public class DefaultSiteBuilder : ISiteBuilder
public class DefaultSiteBuilder(ISiteDefinitionRepository siteDefinitionRepository) : ISiteBuilder
{
private readonly ISiteDefinitionRepository _siteDefinitionRepository;

public DefaultSiteBuilder(ISiteDefinitionRepository siteDefinitionRepository)
{
_siteDefinitionRepository = siteDefinitionRepository;
}

public IEnumerable<HostDefinition> GetHosts()
{
return _siteDefinitionRepository
return siteDefinitionRepository
.List()
.SelectMany(sd => sd.Hosts)
.Where(h => h.Url != null);
Expand Down
Loading

0 comments on commit 6038948

Please sign in to comment.