Skip to content

Commit

Permalink
fix: add Microsoft.Extensions.DependencyInjection
Browse files Browse the repository at this point in the history
  • Loading branch information
lvermeulen committed Dec 28, 2022
1 parent e4e300b commit 1e92b23
Show file tree
Hide file tree
Showing 57 changed files with 2,906 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ jobs:
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.Connector.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.Connector.Testing.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.Runner.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.Runner.Microsoft.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.SqlStreamStore.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.SqlStreamStore.Autofac.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.SqlStreamStore.Microsoft.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.Testing.NUnit.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.Testing.Xunit.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.LastChangedList.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.LastChangedList.Microsoft.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.Syndication.$SEMVER.nupkg
node packages/Be.Vlaanderen.Basisregisters.Build.Pipeline/Content/ci-nuget.js dist/$LIBNAME/$LIBNAME.Syndication.Testing.$SEMVER.nupkg
env:
Expand Down
52 changes: 49 additions & 3 deletions Be.Vlaanderen.Basisregisters.ProjectionHandling.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.156

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33209.295
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C2F8FF63-7A48-4179-A720-86206C42F496}"
EndProject
Expand Down Expand Up @@ -42,6 +43,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Be.Vlaanderen.Basisregister
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication.Tests", "test\Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication.Tests\Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication.Tests.csproj", "{BAF79BC1-602C-4B1C-8B47-7B48D7F03DCC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Microsoft", "src\Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Microsoft\Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Microsoft.csproj", "{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.Microsoft", "src\Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.Microsoft\Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.Microsoft.csproj", "{B59BC9D8-77DE-4A66-9920-514C3773C578}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.Microsoft", "src\Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.Microsoft\Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.Microsoft.csproj", "{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -208,6 +215,42 @@ Global
{BAF79BC1-602C-4B1C-8B47-7B48D7F03DCC}.Release|x64.Build.0 = Release|Any CPU
{BAF79BC1-602C-4B1C-8B47-7B48D7F03DCC}.Release|x86.ActiveCfg = Release|Any CPU
{BAF79BC1-602C-4B1C-8B47-7B48D7F03DCC}.Release|x86.Build.0 = Release|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Debug|x64.ActiveCfg = Debug|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Debug|x64.Build.0 = Debug|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Debug|x86.ActiveCfg = Debug|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Debug|x86.Build.0 = Debug|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Release|Any CPU.Build.0 = Release|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Release|x64.ActiveCfg = Release|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Release|x64.Build.0 = Release|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Release|x86.ActiveCfg = Release|Any CPU
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1}.Release|x86.Build.0 = Release|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Debug|x64.ActiveCfg = Debug|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Debug|x64.Build.0 = Debug|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Debug|x86.ActiveCfg = Debug|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Debug|x86.Build.0 = Debug|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Release|Any CPU.Build.0 = Release|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Release|x64.ActiveCfg = Release|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Release|x64.Build.0 = Release|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Release|x86.ActiveCfg = Release|Any CPU
{B59BC9D8-77DE-4A66-9920-514C3773C578}.Release|x86.Build.0 = Release|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Debug|x64.ActiveCfg = Debug|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Debug|x64.Build.0 = Debug|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Debug|x86.ActiveCfg = Debug|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Debug|x86.Build.0 = Debug|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Release|Any CPU.Build.0 = Release|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Release|x64.ActiveCfg = Release|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Release|x64.Build.0 = Release|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Release|x86.ActiveCfg = Release|Any CPU
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -226,6 +269,9 @@ Global
{2CE13953-AAE6-4AFC-879C-2E09C3CC6397} = {C2F8FF63-7A48-4179-A720-86206C42F496}
{83B43451-645C-498A-8853-BF57CEC14177} = {C2F8FF63-7A48-4179-A720-86206C42F496}
{BAF79BC1-602C-4B1C-8B47-7B48D7F03DCC} = {6DD3C208-58D1-46CE-AEAF-16F3F90D26C5}
{C30BC0D8-6839-4F0F-BDA4-A03635713FD1} = {C2F8FF63-7A48-4179-A720-86206C42F496}
{B59BC9D8-77DE-4A66-9920-514C3773C578} = {C2F8FF63-7A48-4179-A720-86206C42F496}
{43CBD764-F9D0-4BE5-A9F5-FBF54787152E} = {C2F8FF63-7A48-4179-A720-86206C42F496}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2EB87445-E263-4E1E-89CC-3839170028E5}
Expand Down
6 changes: 6 additions & 0 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ Target.create "Lib_Build" (fun _ ->
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.Microsoft"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.Microsoft"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Autofac"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Microsoft"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication.Testing"
buildSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Testing.NUnit"
Expand All @@ -50,9 +53,12 @@ Target.create "Lib_Publish" (fun _ ->
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.Microsoft"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.Microsoft"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Autofac"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Microsoft"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication.Testing"
publishSource "Be.Vlaanderen.Basisregisters.ProjectionHandling.Testing.NUnit"
Expand Down
10 changes: 7 additions & 3 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ nuget Newtonsoft.Json 13.0.1
// VBR STUFF
nuget Be.Vlaanderen.Basisregisters.Build.Pipeline 6.0.3

nuget Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore.Autofac 6.0.0
nuget Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore.Autofac 7.1.1
nuget Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore.Microsoft 7.1.1

nuget Be.Vlaanderen.Basisregisters.EventHandling 4.1.0
nuget Be.Vlaanderen.Basisregisters.EventHandling.Autofac 4.1.0
nuget Be.Vlaanderen.Basisregisters.DependencyInjection 1.0.2

nuget Be.Vlaanderen.Basisregisters.EventHandling 4.2.2
nuget Be.Vlaanderen.Basisregisters.EventHandling.Autofac 4.2.2
nuget Be.Vlaanderen.Basisregisters.EventHandling.Microsoft 4.2.2

nuget Be.Vlaanderen.Basisregisters.EntityFrameworkCore.EntityTypeConfiguration 3.0.0

Expand Down
29 changes: 20 additions & 9 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,26 @@ NUGET
System.Security.Cryptography.ProtectedData (>= 4.5)
System.Text.Json (>= 4.6)
System.Threading.Tasks.Extensions (>= 4.5.4)
Be.Vlaanderen.Basisregisters.AggregateSource (6.0)
Be.Vlaanderen.Basisregisters.AggregateSource (7.1.1)
Be.Vlaanderen.Basisregisters.Utilities.HashCodeCalculator (>= 3.0)
Be.Vlaanderen.Basisregisters.Utilities.HexByteConvertor (>= 3.0)
Be.Vlaanderen.Basisregisters.Utilities.ToStringBuilder (>= 3.0)
Newtonsoft.Json (>= 13.0.1)
NodaTime (>= 3.0.10)
Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore (6.0)
Be.Vlaanderen.Basisregisters.AggregateSource (6.0)
Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore (7.1.1)
Be.Vlaanderen.Basisregisters.AggregateSource (7.1.1)
Be.Vlaanderen.Basisregisters.EventHandling (>= 4.0)
SqlStreamStore (>= 1.2)
Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore.Autofac (6.0)
Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore.Autofac (7.1.1)
Autofac.Extensions.DependencyInjection (>= 7.2)
Be.Vlaanderen.Basisregisters.AggregateSource (6.0)
Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore (6.0)
Be.Vlaanderen.Basisregisters.AggregateSource (7.1.1)
Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore (7.1.1)
SqlStreamStore (>= 1.2)
SqlStreamStore.MsSql (>= 1.2)
Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore.Microsoft (7.1.1)
Be.Vlaanderen.Basisregisters.AggregateSource (7.1.1)
Be.Vlaanderen.Basisregisters.AggregateSource.SqlStreamStore (7.1.1)
Be.Vlaanderen.Basisregisters.DependencyInjection (>= 1.0.2)
SqlStreamStore (>= 1.2)
SqlStreamStore.MsSql (>= 1.2)
Be.Vlaanderen.Basisregisters.Build.Pipeline (6.0.3)
Expand All @@ -59,15 +65,20 @@ NUGET
Be.Vlaanderen.Basisregisters.DataDog.Tracing.Sql (5.0)
Be.Vlaanderen.Basisregisters.DataDog.Tracing (5.0)
System.Data.Common (>= 4.3)
Be.Vlaanderen.Basisregisters.DependencyInjection (1.0.2)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0)
Be.Vlaanderen.Basisregisters.EntityFrameworkCore.EntityTypeConfiguration (3.0)
Microsoft.EntityFrameworkCore (>= 6.0.3)
Be.Vlaanderen.Basisregisters.EventHandling (4.1)
Be.Vlaanderen.Basisregisters.EventHandling (4.2.2)
Be.Vlaanderen.Basisregisters.Converters.TrimString (>= 3.0)
Newtonsoft.Json (>= 13.0.1)
NodaTime.Serialization.JsonNet (>= 3.0)
Be.Vlaanderen.Basisregisters.EventHandling.Autofac (4.1)
Be.Vlaanderen.Basisregisters.EventHandling.Autofac (4.2.2)
Autofac.Extensions.DependencyInjection (>= 7.2)
Be.Vlaanderen.Basisregisters.EventHandling (4.1)
Be.Vlaanderen.Basisregisters.EventHandling (4.2.2)
Be.Vlaanderen.Basisregisters.EventHandling.Microsoft (4.2.2)
Be.Vlaanderen.Basisregisters.DependencyInjection (>= 1.0.2)
Be.Vlaanderen.Basisregisters.EventHandling (4.2.2)
Be.Vlaanderen.Basisregisters.Utilities.HashCodeCalculator (3.0)
Be.Vlaanderen.Basisregisters.Utilities.HexByteConvertor (3.0)
Be.Vlaanderen.Basisregisters.Utilities.ToStringBuilder (3.0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.Microsoft
{
public enum AcceptType
{
Json,
JsonLd,
Xml
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\packages\Be.Vlaanderen.Basisregisters.Build.Pipeline\Content\Be.Vlaanderen.Basisregisters.Build.Pipeline.Settings.Library.props" />

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector\Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.csproj" />
<ProjectReference Include="..\Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner\Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.csproj" />
<ProjectReference Include="..\Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Autofac\Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Autofac.csproj" />
<ProjectReference Include="..\Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore\Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.csproj" />
</ItemGroup>

<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
namespace Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.Microsoft
{
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector;
using global::Microsoft.EntityFrameworkCore;
using Model;

public abstract class LastChangedListConnectedProjection : ConnectedProjection<LastChangedListContext>
{
protected abstract string BuildCacheKey(AcceptType acceptType, string identifier);
protected abstract string BuildUri(AcceptType acceptType, string identifier);

private readonly AcceptType[] _supportedAcceptTypes;
private readonly int _commandTimeoutInSeconds;

protected LastChangedListConnectedProjection(AcceptType[] supportedAcceptTypes) : this(supportedAcceptTypes, 300) {}

protected LastChangedListConnectedProjection(AcceptType[] supportedAcceptTypes, int commandTimeoutInSeconds)
{
_supportedAcceptTypes = supportedAcceptTypes;
_commandTimeoutInSeconds = commandTimeoutInSeconds;
}

protected async Task<IEnumerable<LastChangedRecord>> GetLastChangedRecords(
string identifier,
LastChangedListContext context,
CancellationToken cancellationToken)
{
context.Database.SetCommandTimeout(_commandTimeoutInSeconds);
var attachedRecords = new List<LastChangedRecord>();

// Create a record for every type that our API accepts.
foreach (var acceptType in _supportedAcceptTypes)
{
var shortenedApplicationType = acceptType.ToString().ToLowerInvariant();
var id = $"{identifier}.{shortenedApplicationType}";

var record = await context
.LastChangedList
.FindAsync(id, cancellationToken: cancellationToken);

if (record != null)
attachedRecords.Add(record);
}

return attachedRecords;
}

protected async Task<IEnumerable<LastChangedRecord>> GetLastChangedRecordsAndUpdatePosition(
string identifier,
long position,
LastChangedListContext context,
CancellationToken cancellationToken)
{
context.Database.SetCommandTimeout(_commandTimeoutInSeconds);
var attachedRecords = new List<LastChangedRecord>();

// Create a record for every type that our API accepts.
foreach (var acceptType in _supportedAcceptTypes)
{
var shortenedApplicationType = acceptType.ToString().ToLowerInvariant();
var id = $"{identifier}.{shortenedApplicationType}";

var record = await context
.LastChangedList
.FindAsync(id, cancellationToken: cancellationToken);

if (record == null)
{
record = new LastChangedRecord
{
Id = id,
CacheKey = BuildCacheKey(acceptType, identifier),
Uri = BuildUri(acceptType, identifier),
AcceptType = GetApplicationType(acceptType)
};

await context.LastChangedList.AddAsync(record, cancellationToken);
}

record.Position = position;
attachedRecords.Add(record);
}

return attachedRecords;
}

private static string GetApplicationType(AcceptType acceptType)
{
return acceptType switch
{
AcceptType.Json => "application/json",
AcceptType.JsonLd => "application/ld+json",
AcceptType.Xml => "application/xml",
_ => string.Empty
};
}
}
}
Loading

0 comments on commit 1e92b23

Please sign in to comment.