Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b12a3eb
Commit upgrade plan
Nov 12, 2025
d103aee
Store final changes for step 'Update GitHub Actions workflows to remo…
Nov 12, 2025
63c5ad6
Store final changes for step 'Upgrade src\AltaSoft.DomainPrimitives\A…
Nov 12, 2025
7734441
Store final changes for step 'Upgrade src\AltaSoft.DomainPrimitives.S…
Nov 12, 2025
46ebc0b
Store final changes for step 'Upgrade src\AltaSoft.DomainPrimitives.X…
Nov 12, 2025
81a1f6c
Store final changes for step 'Upgrade tests\AltaSoft.DomainPrimitives…
Nov 12, 2025
2f40001
Store final changes for step 'Upgrade tests\AltaSoft.DomainPrimitives…
Nov 12, 2025
749b0fd
Store final changes for step 'Upgrade tests\AltaSoft.DomainPrimitives…
Nov 12, 2025
5f60658
Some more changes still a lot todo
Nov 12, 2025
46c01b2
Added GenerateImplicitOperator and GenerateNumericOperators support
Nov 24, 2025
53ff9ef
Some more updates to fix issues
Nov 24, 2025
7456950
Verify tests fixed
Nov 24, 2025
211ee85
Fixed numeric operator flag assignment and updated tests.
Nov 25, 2025
bf2f261
Centralized package management and updated frameworks.
Nov 25, 2025
4ab9f7f
MC
Nov 25, 2025
13c5850
MC
Nov 25, 2025
cdb2fe9
merge
Nov 25, 2025
510a742
merge bug fixes
Nov 25, 2025
3d58a21
Source link support added
Nov 25, 2025
aedaa33
MC
Nov 25, 2025
6355643
source links updates should work correctly
Nov 25, 2025
d215559
Enhanced OpenAPI support and refactored schema handling.
Nov 25, 2025
204bc01
Refactored Customer model and updated OpenAPI handling.
Nov 25, 2025
cdbbaa7
Renamed OpenAPI schema transformer methods.
Nov 26, 2025
f8ae9d3
snapshots tests fixed removed null values
Nov 26, 2025
de83baf
Removed extra charactes in csproj
Nov 26, 2025
e1fc891
Updated OpenAPI mappings and added reflection transformer.
Nov 26, 2025
8e11947
minor change
Nov 26, 2025
5b21073
Datetime unspecified used
Dec 16, 2025
5dab04d
Merge branch 'main' into upgrade-to-NET10
Dec 16, 2025
a35c3dd
Merge bug fixes
Dec 16, 2025
e476921
Moved OpenAPI schema transformers to a new project.
Dec 17, 2025
87d7d10
README UPDATE
Dec 19, 2025
2a6dff2
Initial plan
Copilot Dec 30, 2025
f7404e7
Update README.md
temonk Dec 30, 2025
048b428
Update README.md
temonk Dec 30, 2025
b8b1d95
Initial plan
Copilot Dec 30, 2025
b5139ca
Remove .github/upgrades/dotnet-upgrade-plan.md
Copilot Dec 30, 2025
a7848d3
Fix incorrect property name in README - remove obsolete DomainPrimiti…
Copilot Dec 30, 2025
84e7048
Merge pull request #33 from altasoft/copilot/sub-pr-31-again
temonk Jan 5, 2026
4345463
Merge pull request #32 from altasoft/copilot/sub-pr-31
temonk Jan 5, 2026
8da358a
Nuget version updates
Jan 5, 2026
561d0be
Changed version of Microsoft.CodeAnalysis.Analyzers to 3.11.0 as prev…
Jan 5, 2026
51fc030
Bumped version to 7.0.0
Jan 5, 2026
ae6ecb5
Updated package versioning and internalized OpenApiHelperProcessor.
Jan 12, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/build_nuget_dont_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
10.0.x
9.0.x
8.0.x
7.0.x

- name: Extract version from tag
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/v})" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
10.0.x
9.0.x
8.0.x
7.0.x

- name: Restore dependencies
run: dotnet restore
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/publish_nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
10.0.x
9.0.x
8.0.x
7.0.x

- name: Extract version from tag
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/v})" >> $GITHUB_ENV
Expand All @@ -36,3 +36,7 @@ jobs:

- name: Publish
run: dotnet nuget push "nupkg/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json

- name: Publish Symbols
run: dotnet nuget push "nupkg/*.snupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json

11 changes: 9 additions & 2 deletions AltaSoft.DomainPrimitives.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
# Visual Studio Version 18
VisualStudioVersion = 18.0.11217.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AltaSoft.DomainPrimitives.XmlDataTypes", "src\AltaSoft.DomainPrimitives.XmlDataTypes\AltaSoft.DomainPrimitives.XmlDataTypes.csproj", "{E5F41084-26EF-4BA5-A4F9-74105F550CB9}"
EndProject
Expand All @@ -12,6 +12,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BF9447CC-2D00-495A-A8C3-D4890EADB01B}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
LICENSE.txt = LICENSE.txt
README.md = README.md
EndProjectSection
Expand All @@ -33,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AltaSoft.DomainPrimitives.S
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AltaSoft.DomainPrimitives.UnitTests", "tests\AltaSoft.DomainPrimitives.UnitTests\AltaSoft.DomainPrimitives.UnitTests.csproj", "{253F7819-7F69-9B49-8257-65A17B56DF55}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AltaSoft.DomainPrimitives.OpenApiExtensions", "src\AltaSoft.DomainPrimitives.OpenApiExtensions\AltaSoft.DomainPrimitives.OpenApiExtensions.csproj", "{4705B432-D0D1-123B-3566-797F9C9323A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -67,6 +70,10 @@ Global
{253F7819-7F69-9B49-8257-65A17B56DF55}.Debug|Any CPU.Build.0 = Debug|Any CPU
{253F7819-7F69-9B49-8257-65A17B56DF55}.Release|Any CPU.ActiveCfg = Release|Any CPU
{253F7819-7F69-9B49-8257-65A17B56DF55}.Release|Any CPU.Build.0 = Release|Any CPU
{4705B432-D0D1-123B-3566-797F9C9323A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4705B432-D0D1-123B-3566-797F9C9323A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4705B432-D0D1-123B-3566-797F9C9323A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4705B432-D0D1-123B-3566-797F9C9323A7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
23 changes: 19 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
<Project>
<PropertyGroup>
<DefaultTargetFrameworks>net8.0;net9.0;net10.0</DefaultTargetFrameworks>
<OutputType>Library</OutputType>
<Nullable>enable</Nullable>
<LangVersion>Latest</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AnalysisLevel>latest</AnalysisLevel>

<Authors>ALTA Software llc.</Authors>
<Product>Domain Primitives</Product>
<Company>ALTA Software llc.</Company>
<Copyright>Copyright © 2024 ALTA Software llc.</Copyright>
<Version>6.0.4</Version>
<Version>7.0.0</Version>
</PropertyGroup>


<PropertyGroup>
<PackageReadmeFile>README.md</PackageReadmeFile>
<ProjectUrl>https://github.com/altasoft/DomainPrimitives</ProjectUrl>

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RepositoryUrl>https://github.com/altasoft/DomainPrimitives</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageProjectUrl>https://github.com/altasoft/DomainPrimitives</PackageProjectUrl>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<EnableNETAnalyzers>true</EnableNETAnalyzers>

<PackageTags>ddd;domain;entity;dotnet-core;value-object;strongly-typed;</PackageTags>
</PropertyGroup>

<PropertyGroup Condition=" '$(TF_BUILD)' == 'True' ">
<DebugType>embedded</DebugType>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EmbedAllSources>false</EmbedAllSources>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
</PropertyGroup>


<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>
Expand Down
33 changes: 33 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project>
<PropertyGroup>
<!-- Enable Central Package Management -->
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerGen" Version="10.1.0" />
<PackageVersion Include="Microsoft.OpenApi" Version="1.3.1" />
<PackageVersion Include="System.Collections.Frozen" Version="7.0.0" />
<PackageVersion Include="Scalar.AspNetCore" Version="2.11.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.5.0" />
<PackageVersion Include="Verify.Xunit" Version="31.9.3" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.22" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.1" />
</ItemGroup>

</Project>
10 changes: 8 additions & 2 deletions Examples/AltaSoft.DomainPrimitives.Demo.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
# Visual Studio Version 18
VisualStudioVersion = 18.0.11217.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AltaSoft.DomainPrimitives.Demo", "AltaSoft.DomainPrimitives.Demo\AltaSoft.DomainPrimitives.Demo.csproj", "{193DA3B4-7F2C-4EED-A7AF-9F69964B7B27}"
EndProject
Expand All @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AltaSoft.DomainPrimitives",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AltaSoft.DomainPrimitives.SwaggerExtensions", "..\src\AltaSoft.DomainPrimitives.SwaggerExtensions\AltaSoft.DomainPrimitives.SwaggerExtensions.csproj", "{CAEE1818-F333-DF43-89BA-DEC9BD64E279}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AltaSoft.DomainPrimitives.OpenApiExtensions", "..\src\AltaSoft.DomainPrimitives.OpenApiExtensions\AltaSoft.DomainPrimitives.OpenApiExtensions.csproj", "{069E8303-00AA-16AD-9DE1-FCD188DA59B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -39,6 +41,10 @@ Global
{CAEE1818-F333-DF43-89BA-DEC9BD64E279}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAEE1818-F333-DF43-89BA-DEC9BD64E279}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAEE1818-F333-DF43-89BA-DEC9BD64E279}.Release|Any CPU.Build.0 = Release|Any CPU
{069E8303-00AA-16AD-9DE1-FCD188DA59B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{069E8303-00AA-16AD-9DE1-FCD188DA59B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{069E8303-00AA-16AD-9DE1-FCD188DA59B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{069E8303-00AA-16AD-9DE1-FCD188DA59B1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
Expand All @@ -10,14 +10,14 @@
</PropertyGroup>


<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" />
</ItemGroup>


<ItemGroup>
<PackageReference Include="Scalar.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\AltaSoft.DomainPrimitives.OpenApiExtensions\AltaSoft.DomainPrimitives.OpenApiExtensions.csproj" />
<ProjectReference Include="..\..\src\AltaSoft.DomainPrimitives.SwaggerExtensions\AltaSoft.DomainPrimitives.SwaggerExtensions.csproj" />
<ProjectReference Include="..\DomainPrimitivesDemo\DomainPrimitivesDemo.csproj" />
</ItemGroup>
Expand Down
26 changes: 25 additions & 1 deletion Examples/AltaSoft.DomainPrimitives.Demo/Customer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
using System.ComponentModel.DataAnnotations;
using DomainPrimitivesDemo;

namespace AltaSoft.DomainPrimitives.Demo;
public sealed record Customer(CustomerId CustomerId, BirthDate BirthDate, CustomerName CustomerName, CustomerAddress CustomerAddress);
// ReSharper disable InconsistentNaming
public sealed record Customer(

[Required] CustomerId A_CustomerId, [Required] Guid A_CustomerIdDotNet,
[Required] BirthDate B_BirthDate, [Required] DateOnly B_BirthDateDotNet,
[Required] CustomerName C_CustomerName, [Required] string C_CustomerNameDotNet,
[Required] PositiveAmount D_Amount, [Required] decimal D_AmountDotnet)
{
public CustomerAddress? CustomerAddress { get; set; } //ignore
}

public sealed record CustomerNullable(
CustomerId? A_CustomerId,
Guid? A_CustomerIdDotNet,
BirthDate? B_BirthDate,
DateOnly? B_BirthDateDotNet,
CustomerName? C_CustomerName,
string? C_CustomerNameDotNet,
PositiveAmount? D_Amount,
decimal? D_AmountDotnet);

// ReSharper restore InconsistentNaming
public sealed record SetCustomerAddress(CustomerId CustomerId, CustomerAddress CustomerAddress);
public sealed record SetCustomerAddressNullable(CustomerId CustomerId, CustomerAddress? CustomerAddress, PositiveAmount? Amount);

18 changes: 16 additions & 2 deletions Examples/AltaSoft.DomainPrimitives.Demo/CustomerService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using DomainPrimitivesDemo;
using System.Collections.Concurrent;
using DomainPrimitivesDemo;

namespace AltaSoft.DomainPrimitives.Demo;

Expand All @@ -14,7 +14,7 @@ public sealed class CustomerService

public Task AddCustomerAsync(Customer customer)
{
if (!_customers.TryAdd(customer.CustomerId, customer))
if (!_customers.TryAdd(customer.A_CustomerId, customer))
throw new BadHttpRequestException("Customer already exists");

return Task.CompletedTask;
Expand All @@ -30,4 +30,18 @@ public Task SetCustomerAddressAsync(SetCustomerAddress command)
_customers[command.CustomerId] = customer;
return Task.CompletedTask;
}

public Task SetCustomerAddressNullableAsync(SetCustomerAddressNullable command)
{
if (command.CustomerAddress is null)
return Task.CompletedTask;

if (!_customers.TryGetValue(command.CustomerId, out var customer))
throw new BadHttpRequestException("Customer already exists");

customer = customer with { CustomerAddress = command.CustomerAddress };

_customers[command.CustomerId] = customer;
return Task.CompletedTask;
}
}
51 changes: 34 additions & 17 deletions Examples/AltaSoft.DomainPrimitives.Demo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,51 +1,68 @@
using AltaSoft.DomainPrimitives.Demo;
using AltaSoft.DomainPrimitives.OpenApiExtensions;
using AltaSoft.DomainPrimitives.SwaggerExtensions;
using DomainPrimitivesDemo;
using Microsoft.AspNetCore.Mvc;
using Scalar.AspNetCore;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOpenApi(options =>
{
options.AddDomainPrimitivesOpenApiSchemaTransformer();

//options.AddSchemaTransformer(new DomainPrimitiveOpenApiReflectionTransformer());
});

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options => options.AddAllDomainPrimitivesSwaggerMappings());
builder.Services.AddSwaggerGen(options => { options.AddAllDomainPrimitivesSwaggerMappings(); });
builder.Services.AddSingleton<CustomerService>();
builder.Services.AddSingleton<TransferService>();
var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseSwagger();
app.UseSwaggerUI();

var customerGroup = app.MapGroup("v1/Customers")
.WithTags("Customers")
.WithOpenApi();
//scalar
app.MapOpenApi();
app.MapScalarApiReference();

var transferGroup = app.MapGroup("v1/Transfers")
.WithTags("Transfers")
.WithOpenApi();
var customerGroup = app.MapGroup("v1/Customers").WithTags("Customers");
var transferGroup = app.MapGroup("v1/Transfers").WithTags("Transfers");

AddCustomerEndpoints(customerGroup);
AddTransferEndpoints(transferGroup);
app.UseHttpsRedirection();

app.Run();

void AddCustomerEndpoints(IEndpointRouteBuilder routeGroupBuilder)
static void AddCustomerEndpoints(IEndpointRouteBuilder routeGroupBuilder)
{
routeGroupBuilder.MapPost("Add", (Customer command, [FromServices] CustomerService customerService) => customerService.AddCustomerAsync(command));
routeGroupBuilder.MapPost("SetAddress", (SetCustomerAddress command, [FromServices] CustomerService customerService) => customerService.SetCustomerAddressAsync(command));
routeGroupBuilder.MapPost("Add",
(Customer command, [FromServices] CustomerService customerService) => customerService.AddCustomerAsync(command));

routeGroupBuilder.MapPost("AddNull",
(CustomerNullable command, [FromServices] CustomerService customerService) => "1");

routeGroupBuilder.MapPost("SetAddress",
(SetCustomerAddress command, [FromServices] CustomerService customerService) => customerService.SetCustomerAddressAsync(command));
routeGroupBuilder.MapPost("SetAddressNullable",
(SetCustomerAddressNullable command, [FromServices] CustomerService customerService) =>
customerService.SetCustomerAddressNullableAsync(command));
routeGroupBuilder.MapGet("{id}", (CustomerId id, [FromServices] CustomerService customerService) => customerService.GetCustomerByIdAsync(id));
}

void AddTransferEndpoints(IEndpointRouteBuilder routeGroupBuilder)
static void AddTransferEndpoints(IEndpointRouteBuilder routeGroupBuilder)
{
routeGroupBuilder.MapPost("Add", (Transfer command, [FromServices] TransferService service) => service.AddTransferAsync(command));
routeGroupBuilder.MapGet("{id}", (TransferId id, [FromServices] TransferService service) => service.GetTransferByIdAsync(id));
routeGroupBuilder.MapGet("filterValues",
([FromQuery] TransferId? id, [FromServices] TransferService service) =>
id is null ? Task.FromResult<Transfer?>(null) : service.GetTransferByIdAsync(id.Value));
routeGroupBuilder.MapGet("ListTotalAmounts", async (TransferService service) =>
{
var result = await service.ListAsync();
return (PositiveAmount)result.Sum(x => x.TransferAmount + x.TransferFee ?? 0);
});
}

5 changes: 5 additions & 0 deletions Examples/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion Examples/DomainPrimitivesDemo/BirthDate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace DomainPrimitivesDemo
{
/// <summary>
/// CustomerId
/// Birth Date domain primitive representing a customer's date of birth.
/// </summary>
public readonly partial struct BirthDate : IDomainValue<DateOnly>
{
Expand Down
2 changes: 1 addition & 1 deletion Examples/DomainPrimitivesDemo/CustomerId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace DomainPrimitivesDemo;
{
public static PrimitiveValidationResult Validate(Guid value)
{
return PrimitiveValidationResult.Ok;
return value == Guid.Empty ? "Invalid value provided" : PrimitiveValidationResult.Ok;
}

}
Loading
Loading