Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
<Product>Choice generator</Product>
<Company>ALTA Software llc.</Company>
<Copyright>Copyright © 2024 ALTA Software llc.</Copyright>
<Version>1.2.3</Version>
<Version>1.3.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/AltaSoft.Choice.Generator/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ private static SourceCodeBuilder Process(INamedTypeSymbol typeSymbol, List<IProp
sb.Append("[XmlElement(\"").Append(p.XmlNameValue).AppendLine("\")]");
}

sb.AppendLine("[ChoiceProperty]");

sb.Append("public partial ").Append(p.TypeName).Append("? ").Append(p.Name)
.OpenBracket();

Expand Down
9 changes: 9 additions & 0 deletions src/AltaSoft.Choice/ChoicePropertyAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace AltaSoft.Choice;

/// <summary>
/// Represents the attribute used to mark a property as a choice property.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public sealed class ChoicePropertyAttribute : Attribute;
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public Authorisation1Choice()
/// </summary>
[DisallowNull]
[XmlElement("Code")]
[ChoiceProperty]
public partial TestNamespace.OtherNamespace.Authorisation1Code? Code
{
get => _code;
Expand All @@ -67,6 +68,7 @@ public partial TestNamespace.OtherNamespace.Authorisation1Code? Code
/// </summary>
[DisallowNull]
[XmlElement("Proprietary")]
[ChoiceProperty]
public partial string? Proprietary
{
get => _proprietary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public Authorisation1Choice()
/// </summary>
[DisallowNull]
[XmlElement("Code")]
[ChoiceProperty]
public partial string? Code
{
get => _code;
Expand All @@ -67,6 +68,7 @@ public partial string? Code
/// </summary>
[DisallowNull]
[XmlElement("Proprietary")]
[ChoiceProperty]
public partial TestNamespace.OtherNamespace.Authorisation1Code? Proprietary
{
get => _proprietary;
Expand Down
Loading