Merge branch 'feature/operations-dal-adapters' into development
This commit is contained in:
commit
038a420bda
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
.tasks/
|
.tasks/
|
||||||
.agile/
|
.agile/
|
||||||
|
**/bin/
|
||||||
|
**/obj/
|
||||||
|
|||||||
10
Directory.Build.props
Normal file
10
Directory.Build.props
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Authors>AgileWebs</Authors>
|
||||||
|
<Company>AgileWebs</Company>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<RepositoryUrl>http://192.168.68.156:3000/AgileWebs/operations-dal</RepositoryUrl>
|
||||||
|
<PackageProjectUrl>http://192.168.68.156:3000/AgileWebs/operations-dal</PackageProjectUrl>
|
||||||
|
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
5
Operations.DAL.slnx
Normal file
5
Operations.DAL.slnx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<Solution>
|
||||||
|
<Folder Name="/src/">
|
||||||
|
<Project Path="src/Operations.DAL/Operations.DAL.csproj" />
|
||||||
|
</Folder>
|
||||||
|
</Solution>
|
||||||
7
src/Operations.DAL/Contracts/OperationsConfigRecord.cs
Normal file
7
src/Operations.DAL/Contracts/OperationsConfigRecord.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace Operations.DAL.Contracts;
|
||||||
|
|
||||||
|
public sealed record OperationsConfigRecord(
|
||||||
|
string LocationId,
|
||||||
|
string Version,
|
||||||
|
DateTime EffectiveAtUtc,
|
||||||
|
IReadOnlyDictionary<string, bool> FeatureFlags);
|
||||||
9
src/Operations.DAL/Operations.DAL.csproj
Normal file
9
src/Operations.DAL/Operations.DAL.csproj
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
using Operations.DAL.Contracts;
|
||||||
|
|
||||||
|
namespace Operations.DAL.Repositories;
|
||||||
|
|
||||||
|
public interface IOperationsConfigRepository
|
||||||
|
{
|
||||||
|
Task<OperationsConfigRecord?> GetEffectiveAsync(string locationId, DateTime effectiveAtUtc, CancellationToken cancellationToken);
|
||||||
|
Task UpsertAsync(OperationsConfigRecord record, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
using System.Collections.Concurrent;
|
||||||
|
using Operations.DAL.Contracts;
|
||||||
|
|
||||||
|
namespace Operations.DAL.Repositories;
|
||||||
|
|
||||||
|
public sealed class InMemoryOperationsConfigRepository : IOperationsConfigRepository
|
||||||
|
{
|
||||||
|
private readonly ConcurrentDictionary<string, OperationsConfigRecord> store = new();
|
||||||
|
|
||||||
|
public Task<OperationsConfigRecord?> GetEffectiveAsync(string locationId, DateTime effectiveAtUtc, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
store.TryGetValue(locationId, out var record);
|
||||||
|
return Task.FromResult(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task UpsertAsync(OperationsConfigRecord record, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
store[record.LocationId] = record;
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user