Skip to content

Commit

Permalink
UPDATED: Enumeration Generator
Browse files Browse the repository at this point in the history
- Added a nested Added a new file for the JSON converter template
- Generated the JSON converter source each enum field
  • Loading branch information
dgmjr committed Nov 8, 2023
1 parent 780b457 commit af875c6
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Samples/Dgmjr.Enumerations.CodeGenerator.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<Description>Samples for the DGMJR Enumeration data structure generator</Description>
</PropertyGroup>
<ItemGroup>
<SourceGeneratorPackageReference Include="Dgmjr.Enumerations.CodeGenerator" />
<PackageReference Include="Dgmjr.Enumerations.CodeGenerator" IncludeAssets="Analyzers;Build" ExcludeAssets="Native;BuildTransitive;BuildMultitargeting;ContentFiles;Compile;Runtime" PrivateAssets="All" />
<!-- <PackageReference Include="Dgmjr.Enumerations.CodeGenerator" IncludeAssets="Analyzers;Build" ExcludeAssets="Native;BuildTransitive;ContentFiles" PrivateAssets="All" /> -->
<!-- <ProjectReference Include="../src/Dgmjr.Enumerations.CodeGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true" IncludeAssets="Analyzers;Build" ExcludeAssets="Native;BuildTransitive;ContentFiles" PrivateAssets="None" /> -->
<PackageReference Include="Dgmjr.Enumerations.Enumeration" />
Expand Down
26 changes: 13 additions & 13 deletions Samples/Dgmjr.Enumerations.CodeGenerator.Samples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\..\Packages\Versions.Local.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Enumerations.CodeGenerator.Samples", "Dgmjr.Enumerations.CodeGenerator.Samples.csproj", "{166E5F60-3449-4A11-AA22-092E10E19564}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Enumerations.CodeGenerator.Samples", "Dgmjr.Enumerations.CodeGenerator.Samples.csproj", "{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -20,18 +20,18 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{166E5F60-3449-4A11-AA22-092E10E19564}.Local|Any CPU.ActiveCfg = Local|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Local|Any CPU.Build.0 = Local|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Debug|Any CPU.Build.0 = Debug|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Testing|Any CPU.Build.0 = Testing|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Staging|Any CPU.Build.0 = Staging|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Production|Any CPU.ActiveCfg = Local|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Production|Any CPU.Build.0 = Local|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Release|Any CPU.ActiveCfg = Release|Any CPU
{166E5F60-3449-4A11-AA22-092E10E19564}.Release|Any CPU.Build.0 = Release|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Local|Any CPU.ActiveCfg = Local|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Local|Any CPU.Build.0 = Local|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Testing|Any CPU.Build.0 = Testing|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Staging|Any CPU.Build.0 = Staging|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Production|Any CPU.ActiveCfg = Local|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Production|Any CPU.Build.0 = Local|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72AF42ED-1B8A-46BA-BDB6-E666F7019AF7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 2 additions & 1 deletion Tests/Dgmjr.Enumerations.CodeGenerator.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ProjectGuid>8037C3AA-FC4B-4379-8C4E-0517FC90E94E</ProjectGuid>
</PropertyGroup>

<ItemGroup>
Expand All @@ -40,7 +41,7 @@
<ProjectReference Include="../src/Dgmjr.Enumerations.CodeGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true" IncludeAssets="Analyzers;Build;Compile;Runtime" ExcludeAssets="Native;BuildTransitive;ContentFiles" PrivateAssets="All" />

<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" />
<UsingsPackageReference Include="MSBuild.Usings" />
<PackageReference Include="MSBuild.Usings" IncludeAssets="Build;BuildTransitive;BuildMultitargeting;Runtime;Compile" ExcludeAssets="ContentFiles;Native;Analyzers" PrivateAssets="None" />
<!-- <ProjectReference Include="../src/Runtime/Dgmjr.Enumerations.CodeGenerator.Runtime.csproj" Targets="Restore;Build" /> -->
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions Tests/Dgmjr.Enumerations.CodeGenerator.Tests.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
#
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}"
ProjectSection(SolutionItems) = preProject
..\..\..\..\..\Directory.Build.props = ..\..\..\..\..\Directory.Build.props
Expand Down
14 changes: 14 additions & 0 deletions src/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Reflection.PortableExecutable;
/*
* Constants.cs
*
Expand Down Expand Up @@ -51,6 +52,7 @@ internal static class Constants
public const string DisplayAttribute = nameof(DisplayAttribute);
public const string DisplayName = nameof(DisplayName);
public const string Enumeration = nameof(Enumeration);
public const string EnumerationJsonConverter = nameof(EnumerationJsonConverter);
public const string GenerateEnumerationClassAttribute = nameof(
GenerateEnumerationClassAttribute
);
Expand Down Expand Up @@ -144,6 +146,10 @@ internal static class Constants

private static readonly string IEnumerationDeclaration =
typeof(Constants).Assembly.ReadAssemblyResourceAllText($"I{Enumeration}.{scriban}");
private static readonly string EnumerationJsonConverterDeclaration =
typeof(Constants).Assembly.ReadAssemblyResourceAllText(
$"{EnumerationJsonConverter}.{scriban}"
);

// """
// namespace {{ dto_namespace }}.Abstractions;
Expand Down Expand Up @@ -194,6 +200,10 @@ internal static class Constants
nameof(NestedEnumerationTypeDeclaration)
);

private static readonly Template EnumerationJsonConverterDeclarationTemplate = Template.Parse(
EnumerationJsonConverterDeclaration
);

public static string RenderHeader(string filename) => //Comment;
HeaderTemplate.Render(new FilenameAndTimestampTuple(filename));

Expand All @@ -204,6 +214,10 @@ internal static class Constants
// DateTimeOffset.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.ffffzzzZ")
// );

public static string RenderJsonConverterDeclaration(EnumerationFieldDto e) => //Comment;
// IEnumerationDeclarationTemplate.Render(e);
EnumerationJsonConverterDeclarationTemplate.Render(e);

public static string RenderIEnumerationDeclaration(EnumerationDto e) => //Comment;
// IEnumerationDeclarationTemplate.Render(e);
IEnumerationDeclaration
Expand Down
3 changes: 2 additions & 1 deletion src/Dgmjr.Enumerations.CodeGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Description>This package contains a source generator, which generates enumeration data structures from enum types.</Description>
<IsRoslynComponent>true</IsRoslynComponent>
<NoWarn>$(NoWarn);S3903;RCS1110;S3604</NoWarn>
<ProjectGuid>C4622771-2A7B-42E6-9B3C-8F71CDD7E65B</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<!-- <PackageReference Include="Dgmjr.CodeGeneration.Logging" /> -->
Expand All @@ -34,7 +35,7 @@
<PackageReference Include="Scriban.Signed" Aliases="Scrib" />
<PackageReference Include="ThisAssembly.AssemblyInfo" />
<PackageReference Include="ThisAssembly.Project" />
<UsingsPackageReference Include="System.Text.Json.Usings" />
<PackageReference Include="System.Text.Json.Usings" IncludeAssets="Build;BuildTransitive;BuildMultitargeting;Runtime;Compile" ExcludeAssets="ContentFiles;Native;Analyzers" PrivateAssets="None" />
</ItemGroup>

<ItemGroup>
Expand Down
36 changes: 18 additions & 18 deletions src/Dgmjr.Enumerations.CodeGenerator.sln
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
#
#
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}"
ProjectSection(SolutionItems) = preProject
..\..\..\..\..\Directory.Build.props = ..\..\..\..\..\Directory.Build.props
Expand All @@ -8,30 +8,30 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\..\Packages\Versions.Local.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Enumerations.CodeGenerator", "Dgmjr.Enumerations.CodeGenerator.csproj", "{AC845DE2-CF87-49D2-A8A3-2019389FF879}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Enumerations.CodeGenerator", "Dgmjr.Enumerations.CodeGenerator.csproj", "{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Local|Any CPU = Local|Any CPU
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Testing|Any CPU = Testing|Any CPU
Staging|Any CPU = Staging|Any CPU
Production|Any CPU = Production|Any CPU
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Local|Any CPU.ActiveCfg = Local|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Local|Any CPU.Build.0 = Local|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Testing|Any CPU.Build.0 = Testing|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Staging|Any CPU.Build.0 = Staging|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Production|Any CPU.ActiveCfg = Local|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Production|Any CPU.Build.0 = Local|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC845DE2-CF87-49D2-A8A3-2019389FF879}.Release|Any CPU.Build.0 = Release|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Local|Any CPU.ActiveCfg = Local|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Local|Any CPU.Build.0 = Local|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Testing|Any CPU.Build.0 = Testing|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Staging|Any CPU.Build.0 = Staging|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Production|Any CPU.ActiveCfg = Local|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Production|Any CPU.Build.0 = Local|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4622771-2A7B-42E6-9B3C-8F71CDD7E65B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
21 changes: 21 additions & 0 deletions src/EnumerationGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,27 @@ ImmutableArray<GeneratorAttributeSyntaxContext> values
{nestedClassDeclaration.NormalizeWhitespace().GetText()}
"""
);
// Generate the nested class declaration
var jsonConverterDeclaration = RenderJsonConverterDeclaration(
new EnumerationFieldDto(
enumSymbol.GetMembers(fieldName).OfType<IFieldSymbol>().FirstOrDefault(),
dataStructureType,
dtoTypeName,
dtoNamespace,
enumSymbol.EnumUnderlyingType.ToDisplayString(),
enumSymbol.MetadataName,
baseType
)
);

fileName = $"{dtoTypeName}.{fieldName}JsonConverter.g.cs";
context.AddSource(
fileName,
$"""
{RenderHeader(fileName)}
{ParseCompilationUnit(jsonConverterDeclaration).NormalizeWhitespace().GetText()}
"""
);
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions src/Resources/EnumerationJsonConverter.scriban
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace {{ dto_namespace }};
using {{ dto_namespace }}.Abstractions;

public partial {{ data_structure_type }} @{{ dto_type_name }}
{
{{ compiler_generated_attributes }}
public class {{ field_name }}JsonConverter : System.Text.Json.Serialization.JsonConverter<I{{ dto_type_name }}>
{
public override bool CanConvert(type typeToConvert) =>
typeof(I{{ dto_type_name }}).IsAssignableFrom(typeToConvert);

public override I{{ dto_type_name }} Read(
ref Utf8JsonReader reader,
type typeToConvert,
JsonSerializerOptions options
) =>
@{{ dto_type_name }}.Parse(
reader.TokenType == JsonTokenType.String
? reader.GetString()
: reader.GetInt32().ToString()
);

public override void Write(Utf8JsonWriter writer, I{{ dto_type_name }} value, Jso options) =>
writer.WriteStringValue(value.ShortName);
}

public class {{ field_name }}JsonConverterAttribute : System.Text.Json.Serialization.JsonConverterAttribute
{
public {{ field_name }}JsonConverterAttribute() : base(typeof({{ field_name }}JsonConverter)) { }
}
}
3 changes: 3 additions & 0 deletions src/Resources/Header.scriban
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Text.Json.Serialization;
using System.Text.Json;
using System.Xml.Serialization;
#if NET7_0_OR_GREATER
using StringSyntax = System.Diagnostics.CodeAnalysis.StringSyntaxAttribute;
#endif
Expand Down
1 change: 1 addition & 0 deletions src/Resources/IEnumeration.scriban
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ IHaveAName,
IHaveAValue<{{ enum_namespace }}.{{ enum_type_name }}>,
IHaveADescription,
IHaveAUri,
IHaveAuri,
IHaveAUriString,
IHaveSynonyms,
IHaveAShortName,
Expand Down
41 changes: 21 additions & 20 deletions src/Resources/NestedEnumerationType.scriban
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,10 @@ public partial {{ data_structure_type }} @{{ dto_type_name }} {{ if base_type !=
/// <summary>{{ description }}</summary>
/// <value><see cref="{{ enum_namespace }}.{{ enum_type }}.{{ field_name }}" /><value>
{{ compiler_generated_attributes }}
[{{ field_name }}JsonConverterAttribute]
public partial {{ data_structure_type }} @{{ field_name }} :
{{ if base_type != "" && base_type != null }}{{ dto_type_name }}, {{ end }}
I{{ enumeration_name }},
IHaveAName,
IHaveAValue,
IHaveAValue<{{ enum_underlying_type }}>,
IHaveAValue<{{ enum_namespace }}.{{ enum_type }}>,
IHaveADescription,
IHaveAUri,
IHaveAuri,
IHaveAUriString,
IHaveSynonyms,
IHaveAShortName,
IHaveAGuid,
IHaveAGuidString,
IHaveADisplayName,
IIdentifiable,
IIdentifiable<{{ enum_underlying_type }}>,
IConvertible,
IEquatable<{{ enum_underlying_type }}>,
IEquatable<I{{ dto_type_name }}>
I{{ enumeration_name }}
{
/// <summary>The {{ enumeration_name }}'s value</summary>
/// <value><see cref="{{ enum_namespace }}.{{ enum_type }}.{{ field_name }}" /></value>
Expand Down Expand Up @@ -79,80 +62,98 @@ public partial {{ data_structure_type }} @{{ dto_type_name }} {{ if base_type !=

/// <summary>The {{ enumeration_name }}'s synonyms</summary>
/// <value>{{ synonyms }}</value>
[JsonIgnore, XmlIgnore]
public static readonly string[] Synonyms = new string[] {
{{ synonyms }}
};

/// <summary>The {{ enumeration_name }}'s value</summary>
/// <value><see cref="{{ enum_namespace }}.{{ enum_type }}.{{ field_name }}" /></value>
[JsonIgnore, XmlIgnore]
{{ enum_namespace }}.{{ enum_type }} IHaveAValue<{{ enum_namespace }}.{{ enum_type }}>.Value => Value;

/// <summary>The {{ enumeration_name }}'s value as a(n) <see langword="{{ enum_underlying_type }}" /></summary>
/// <value>{{ id }}</value>
[JsonIgnore, XmlIgnore]
{{ enum_underlying_type }} IHaveAValue<{{ enum_underlying_type }}>.Value => Id;

/// <summary>The {{ enumeration_name }}'s GUID</summary>
/// <value>{{ guid_string }}</value>
[JsonIgnore, XmlIgnore]
guid IHaveAGuid.Guid => Guid;

/// <summary>The {{ enumeration_name }}'s GUID</summary>
/// <value>{{ guid_string }}</value>
[JsonIgnore, XmlIgnore]
string IHaveAGuidString.GuidString => GuidString;

/// <summary>The {{ enumeration_name }}'s display name</summary>
/// <value>{{ display_name }}</value>
[JsonIgnore, XmlIgnore]
string IHaveADisplayName.DisplayName => DisplayName;

/// <summary>The {{ enumeration_name }}'s value</summary>
/// <value><see cref="{{ enum_namespace }}.{{ enum_type }}.{{ field_name }}" /><value>
[JsonIgnore, XmlIgnore]
object IHaveAValue.Value => Value;

/// <summary>A short description of the {{ enumeration_name }}</summary>
/// <value>{{ description }}</value>
[JsonIgnore, XmlIgnore]
string IHaveADescription.Description => Description;

/// <summary>The {{ enumeration_name }}'s name</summary>
/// <value>{{ field_name }}</value>
[JsonIgnore, XmlIgnore]
string IHaveAName.Name => Name;

/// <summary>The {{ enumeration_name }}'s short name</summary>
/// <value>{{ short_name }}</value>
[JsonIgnore, XmlIgnore]
string IHaveAShortName.ShortName => ShortName;

/// <summary>The {{ enumeration_name }}'s URI</summary>
/// <value>{{ uri_string }}</value>
[JsonIgnore, XmlIgnore]
Uri IHaveAUri.Uri => Uri;

/// <summary>The {{ enumeration_name }}'s URI</summary>
/// <value>{{ uri_string }}</value>
[JsonIgnore, XmlIgnore]
string IHaveAUriString.UriString => UriString;

/// <summary>The {{ enumeration_name }}'s URI</summary>
/// <value>{{ uri_string }}</value>
[JsonIgnore, XmlIgnore]
System.uri IHaveAuri.Uri => System.uri.From(Uri.ToString());

/// <summary>The order in which the {{ enumeration_name }} should appear</summary>
/// <value>{{ order }}</value>
/// <default>0</default>
[JsonIgnore, XmlIgnore]
int I{{ enumeration_name }}.Order => Order;

/// <summary>The {{ enumeration_name }}'s URI</summary>
/// <value>{{ uri_string }}</value>
[JsonIgnore, XmlIgnore]
uri I{{ dto_type_name }}.Uri => uri.From(Uri.ToString());

/// <summary>The {{ enumeration_name }}'s Id as an <see langword="object" /></summary>
/// <value>{{ id }}</value>
[JsonIgnore, XmlIgnore]
object IIdentifiable.Id => Id;

/// <summary>The {{ enumeration_name }}'s Id as a(n) <see langword="{{ enum_underlying_type }}" /></summary>
/// <value>{{ id }}</value>
[JsonIgnore, XmlIgnore]
{{ enum_underlying_type }} IIdentifiable<{{ enum_underlying_type }}>.Id => Id;

/// <summary>The {{ enumeration_name }}'s synonyms</summary>
/// <value>{{ synonyms }}</value>
[JsonIgnore, XmlIgnore]
string[] IHaveSynonyms.Synonyms { get => Synonyms; init { } }

bool IEquatable<I{{ enumeration_name }}>.Equals(I{{ enumeration_name }} value)
bool IEquatable<I{{ enumeration_name }}>.Equals(I{{ enumeration_name }}? value)
=> this == value;

bool IEquatable<{{ enum_underlying_type }}>.Equals({{ enum_underlying_type }} value)
Expand Down

0 comments on commit af875c6

Please sign in to comment.