Skip to content

Commit 064610d

Browse files
committed
Nicer DebuggerDisplay of Wrappers/Identities.
1 parent f6c9309 commit 064610d

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

DomainModeling.Generator/IdentityGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ private static void GenerateSource(SourceProductionContext context, (Generatable
509509
var source = $@"
510510
using System;
511511
using System.Collections.Generic;
512+
using System.Diagnostics;
512513
using System.Diagnostics.CodeAnalysis;
513514
using System.Runtime.CompilerServices;
514515
using Architect.DomainModeling;
@@ -525,6 +526,7 @@ namespace {containingNamespace}
525526
{(existingComponents.HasFlags(IdTypeComponents.SystemTextJsonConverter) ? "//" : "")}{JsonSerializationGenerator.WriteJsonConverterAttribute(idTypeName, underlyingTypeFullyQualifiedName, numericAsString: underlyingTypeIsNumericUnsuitableForJson)}
526527
{(existingComponents.HasFlags(IdTypeComponents.NewtonsoftJsonConverter) ? "//" : "")}{JsonSerializationGenerator.WriteNewtonsoftJsonConverterAttribute(idTypeName, underlyingTypeFullyQualifiedName, numericAsString: underlyingTypeIsNumericUnsuitableForJson)}
527528
{(hasIdentityValueObjectAttribute ? "" : $"[IdentityValueObject<{underlyingTypeFullyQualifiedName}>]")}
529+
[DebuggerDisplay(""{{ToString(){(coreTypeFullyQualifiedName == "string" ? "" : ",nq")}}}"")]
528530
[CompilerGenerated] {accessibility.ToCodeString()} readonly{(entityTypeName is null ? " partial" : "")}{(isRecord ? " record" : "")} struct {idTypeName} :
529531
IIdentity<{underlyingTypeFullyQualifiedName}>,
530532
IEquatable<{idTypeName}>,

DomainModeling.Generator/WrapperValueObjectGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ private static void GenerateSource(SourceProductionContext context, (Generatable
434434
var source = $@"
435435
using System;
436436
using System.Collections.Generic;
437+
using System.Diagnostics;
437438
using System.Diagnostics.CodeAnalysis;
438439
using System.Runtime.CompilerServices;
439440
using Architect.DomainModeling;
@@ -447,6 +448,7 @@ namespace {containingNamespace}
447448
{{
448449
{(existingComponents.HasFlags(WrapperValueObjectTypeComponents.SystemTextJsonConverter) ? "//" : "")}{JsonSerializationGenerator.WriteJsonConverterAttribute(typeName, underlyingTypeFullyQualifiedName)}
449450
{(existingComponents.HasFlags(WrapperValueObjectTypeComponents.NewtonsoftJsonConverter) ? "//" : "")}{JsonSerializationGenerator.WriteNewtonsoftJsonConverterAttribute(typeName, underlyingTypeFullyQualifiedName)}
451+
[DebuggerDisplay(""{{ToString(){(coreTypeFullyQualifiedName == "string" ? "" : ",nq")}}}"")]
450452
[CompilerGenerated] {generatable.Accessibility.ToCodeString()} {(generatable.IsClass ? "sealed" : "readonly")} partial {(generatable.IsRecord ? "record " : "")}{(generatable.IsClass ? "class" : "struct")} {typeName} :
451453
IWrapperValueObject<{underlyingTypeFullyQualifiedName}>,
452454
IEquatable<{typeName}>,

DomainModeling/DomainModeling.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Misc:
7171
- Fix: Fixed bug where DummyBuilder generator struggled with nested types.
7272
- Fix: Fixed bug where "no source generation on nested type" warning would not show.
7373
- Enhancement: Generated types now have the CompilerGeneratedAttribute.
74+
- Enhancement: Nicer DebuggerDisplay of Wrappers/Identities.
7475
- Enhancement: Generated struct Wrappers/Identities now generate NULLABLE comparison operators, to circumvent counterintuitive lifting behavior.
7576
- Enhancement: Improved clarity of analyzer warnings, by stopping before subsequent problems occur.
7677
- Enhancement: Improved correctness of trimming.

0 commit comments

Comments
 (0)