Skip to content

Commit 4449bb8

Browse files
authored
Merge pull request #5 from altasoft/feature/ChoicePropertyAttributeAdded
Bump version to 1.3.0 and add ChoiceProperty attribute
2 parents a067000 + d8adff7 commit 4449bb8

5 files changed

Lines changed: 16 additions & 1 deletion

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Product>Choice generator</Product>
1010
<Company>ALTA Software llc.</Company>
1111
<Copyright>Copyright © 2024 ALTA Software llc.</Copyright>
12-
<Version>1.2.3</Version>
12+
<Version>1.3.0</Version>
1313
</PropertyGroup>
1414

1515
<PropertyGroup>

src/AltaSoft.Choice.Generator/Executor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ private static SourceCodeBuilder Process(INamedTypeSymbol typeSymbol, List<IProp
115115
sb.Append("[XmlElement(\"").Append(p.XmlNameValue).AppendLine("\")]");
116116
}
117117

118+
sb.AppendLine("[ChoiceProperty]");
119+
118120
sb.Append("public partial ").Append(p.TypeName).Append("? ").Append(p.Name)
119121
.OpenBracket();
120122

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace AltaSoft.Choice;
4+
5+
/// <summary>
6+
/// Represents the attribute used to mark a property as a choice property.
7+
/// </summary>
8+
[AttributeUsage(AttributeTargets.Property)]
9+
public sealed class ChoicePropertyAttribute : Attribute;

tests/AltaSoft.Choice.Generator.SnapshotTests/Snapshots/ChoiceGeneratorTest.ChoiceTypeShouldGenerateAllMethodsAndCompileCorrectly#Authorisation1Choice.g.verified.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public Authorisation1Choice()
4949
/// </summary>
5050
[DisallowNull]
5151
[XmlElement("Code")]
52+
[ChoiceProperty]
5253
public partial TestNamespace.OtherNamespace.Authorisation1Code? Code
5354
{
5455
get => _code;
@@ -67,6 +68,7 @@ public partial TestNamespace.OtherNamespace.Authorisation1Code? Code
6768
/// </summary>
6869
[DisallowNull]
6970
[XmlElement("Proprietary")]
71+
[ChoiceProperty]
7072
public partial string? Proprietary
7173
{
7274
get => _proprietary;

tests/AltaSoft.Choice.Generator.SnapshotTests/Snapshots/ChoiceGeneratorTest.ChoiceTypeShouldNotGenerateImplicitMethodsAndCompileCorrectly#Authorisation1Choice.g.verified.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public Authorisation1Choice()
4949
/// </summary>
5050
[DisallowNull]
5151
[XmlElement("Code")]
52+
[ChoiceProperty]
5253
public partial string? Code
5354
{
5455
get => _code;
@@ -67,6 +68,7 @@ public partial string? Code
6768
/// </summary>
6869
[DisallowNull]
6970
[XmlElement("Proprietary")]
71+
[ChoiceProperty]
7072
public partial TestNamespace.OtherNamespace.Authorisation1Code? Proprietary
7173
{
7274
get => _proprietary;

0 commit comments

Comments
 (0)