Skip to content

Commit

Permalink
Merge pull request #16 from DylanSnel/equalitComponents-internal
Browse files Browse the repository at this point in the history
feat(Generators): Update ValueObjectGenerator
  • Loading branch information
DylanSnel authored Sep 13, 2024
2 parents d892d27 + 48a98e5 commit ed4675b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageIcon>DDDToolkit-Icon.png</PackageIcon>
<Version>2.0.2.16</Version>
<Version>2.0.2.17</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions Examples/DDDToolkit.NugetApi/DDDToolkit.NugetApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DDDToolkit" Version="2.0.3" />
<PackageReference Include="DDDToolkit" Version="2.0.13" />

<PackageReference Include="DDDToolkit.EntityFramework" Version="2.0.3" />
<PackageReference Include="DDDToolkit.EntityFramework" Version="2.0.13" />

<PackageReference Include="DDDToolkit.FluentValidation" Version="2.0.3" />
<PackageReference Include="DDDToolkit.FluentValidation" Version="2.0.13" />

<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ private static void CreateValueObject(SourceProductionContext context, (ResultTy
return;
}


var valueObjectInfo = new ValueObjectInfo(recordDeclaration, options);


foreach (var property in valueObjectInfo.ConverterConstructorProperties)
{
if (!property.HasInitSetter())
Expand All @@ -65,8 +63,6 @@ private static void CreateValueObject(SourceProductionContext context, (ResultTy
}
}



var sourceCode = $$$"""
// <auto-generated/>
using DDDToolkit.BaseTypes;
Expand All @@ -81,6 +77,7 @@ namespace {{{valueObjectInfo.Namespace}}};
partial record {{{valueObjectInfo.Name}}} : ValueObject
{
[Internal]
public override IEnumerable<object?> GetEqualityComponents()
{
{{{string.Join("\n", valueObjectInfo.EqualityComponents)}}}
Expand Down Expand Up @@ -159,7 +156,6 @@ public override int GetHashCode()
""";
}


internal class ValueObjectInfo(RecordDeclarationSyntax recordDeclaration, DDDOptions options)
{
public RecordDeclarationSyntax RecordDeclaration { get; } = recordDeclaration;
Expand Down

0 comments on commit ed4675b

Please sign in to comment.