Skip to content

Commit b587d19

Browse files
committed
Deps update
1 parent a5e9f79 commit b587d19

File tree

9 files changed

+35
-20
lines changed

9 files changed

+35
-20
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Smart Enums:
2424

2525
Value objects:
2626
* [Open-ended End Date](https://github.com/PawelGerr/Thinktecture.Runtime.Extensions/wiki/Value-Objects#open-ended-end-date)
27+
* [(Always-positiv) Amount](https://github.com/PawelGerr/Thinktecture.Runtime.Extensions/wiki/Value-Objects#always-positiv-amount)
2728

2829
# Requirements
2930

samples/Newtonsoft.Json.AspNetCore.Samples/Thinktecture.Runtime.Extensions.Newtonsoft.Json.AspNetCore.Samples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<NoWarn>$(NoWarn);CA2007;CA2234</NoWarn>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.4" />
7+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.5" />
88
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
99
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
1010
</ItemGroup>

samples/Thinktecture.Runtime.Extensions.Benchmarking/Thinktecture.Runtime.Extensions.Benchmarking.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ItemGroup>
88
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
99
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
10-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
10+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
1111
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
1212
</ItemGroup>
1313

samples/Thinktecture.Runtime.Extensions.EntityFrameworkCore.Samples/Thinktecture.Runtime.Extensions.EntityFrameworkCore.Samples.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<ProjectReference Include="..\..\src\Thinktecture.Runtime.Extensions.SourceGenerator\Thinktecture.Runtime.Extensions.SourceGenerator.csproj" SetTargetFramework="TargetFramework=netstandard2.0" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
99
</ItemGroup>
1010
<ItemGroup>
11-
<PackageReference Include="ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly" Version="7.0.1" />
12-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
11+
<PackageReference Include="ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly" Version="7.0.2" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
1313
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
1414
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
1515
</ItemGroup>

samples/Thinktecture.Runtime.Extensions.Samples/ValueObjects/Amount.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
namespace Thinktecture.ValueObjects;
44

5-
[ValueObject(ComparisonOperators = OperatorsGeneration.DefaultWithKeyTypeOverloads,
6-
AdditionOperators = OperatorsGeneration.DefaultWithKeyTypeOverloads,
5+
[ValueObject(DefaultInstancePropertyName = "Zero", // renames Amount.Empty to Amount.Zero
6+
ComparisonOperators = OperatorsGeneration.DefaultWithKeyTypeOverloads, // for comparison of amount with a decimal without implicit conversion: amount > 42m
7+
AdditionOperators = OperatorsGeneration.DefaultWithKeyTypeOverloads, // for arithmetic operations of amount with a decimal without implicit conversion: amount + 42m
78
SubtractionOperators = OperatorsGeneration.DefaultWithKeyTypeOverloads,
89
MultiplyOperators = OperatorsGeneration.DefaultWithKeyTypeOverloads,
910
DivisionOperators = OperatorsGeneration.DefaultWithKeyTypeOverloads)]
10-
public sealed partial class Amount
11+
public readonly partial struct Amount
1112
{
12-
private readonly int _value;
13+
private readonly decimal _value;
1314

14-
static partial void ValidateFactoryArguments(ref ValidationResult? validationResult, ref int value)
15+
static partial void ValidateFactoryArguments(ref ValidationResult? validationResult, ref decimal value)
1516
{
1617
if (value < 0)
1718
validationResult = new ValidationResult("Amount must be positive.");

samples/Thinktecture.Runtime.Extensions.Samples/ValueObjects/ValueObjectDemos.cs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public static void Demo(ILogger logger)
1111
{
1212
DemoForSimpleValueObjects(logger);
1313
DemoForEndDate(logger);
14+
DemosForAmount(logger);
15+
1416
DemoForComplexValueObjects(logger);
1517
}
1618

@@ -67,25 +69,36 @@ private static void DemoForSimpleValueObjects(ILogger logger)
6769

6870
if (ProductName.TryParse("New product name", null, out var productName))
6971
logger.Information("Parsed name: {ParsedProductName}", productName);
72+
}
73+
74+
private static void DemosForAmount(ILogger logger)
75+
{
76+
logger.Information("""
77+
78+
79+
==== Demo for Amount ====
80+
81+
""");
7082

71-
var formattedValue = Amount.Create(42).ToString("000", CultureInfo.InvariantCulture); // "042"
83+
var formattedValue = Amount.Create(42.1m).ToString("000.00", CultureInfo.InvariantCulture); // "042.10"
7284
logger.Information("Formatted: {Formatted}", formattedValue);
7385

7486
var amount = Amount.Create(1);
75-
var otherAmount = Amount.Create(2);
87+
var otherAmount = (Amount)2;
88+
var zero = Amount.Zero;
7689

77-
var comparison = amount.CompareTo(otherAmount);
78-
logger.Information("Comparison: {Comparison}", comparison);
90+
logger.Information("Comparison: 1.CompareTo(2) = {Comparison}", amount.CompareTo(otherAmount)); // -1
91+
logger.Information("Comparison: 1 == 0 = {Comparison}", amount == zero); // false
7992

8093
// Addition / subtraction / multiplication / division / comparison
81-
logger.Information("{Amount} + {Other} = {Sum}", amount, otherAmount, amount + otherAmount);
82-
logger.Information("{Amount} > {Other} = {Result}", amount, otherAmount, amount > otherAmount);
94+
logger.Information("{Amount} + {Other} = {Sum}", amount, otherAmount, amount + otherAmount); // 1 + 2 = 3
95+
logger.Information("{Amount} > {Other} = {Result}", amount, otherAmount, amount > otherAmount); // 1 > 2 = False
8396

8497
// Addition with key-member type due to [ValueObject(AdditionOperators = OperatorsGeneration.DefaultWithKeyTypeOverloads)]
85-
logger.Information("{Amount} + {Other} = {Sum}", amount, 42, amount + 42);
98+
logger.Information("{Amount} + {Other} = {Sum}", amount, 42, amount + 42); // 1 + 42 = 43
8699

87100
// Comparison with key-member type due to [ValueObject(ComparisonOperators = OperatorsGeneration.DefaultWithKeyTypeOverloads)]
88-
logger.Information("{Amount} > {Other} = {Result}", amount, 42, amount > 42);
101+
logger.Information("{Amount} > {Other} = {Result}", amount, 42, amount > 42); // 1 > 42 = False
89102
}
90103

91104
private static void DemoForEndDate(ILogger logger)

src/Thinktecture.Runtime.Extensions.EntityFrameworkCore6/Thinktecture.Runtime.Extensions.EntityFrameworkCore6.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.15" />
17+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.16" />
1818
</ItemGroup>
1919

2020
</Project>

src/Thinktecture.Runtime.Extensions.EntityFrameworkCore7/Thinktecture.Runtime.Extensions.EntityFrameworkCore7.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.4" />
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.5" />
1515
</ItemGroup>
1616

1717
</Project>

src/Thinktecture.Runtime.Extensions.MessagePack/Thinktecture.Runtime.Extensions.MessagePack.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="MessagePack" Version="2.5.103" />
13+
<PackageReference Include="MessagePack" Version="2.5.108" />
1414
</ItemGroup>
1515

1616
</Project>

0 commit comments

Comments
 (0)