diff --git a/Directory.Build.props b/Directory.Build.props index e9cce9b..07af1fe 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,7 +9,7 @@ Domain Primitives ALTA Software llc. Copyright © 2024 ALTA Software llc. - 2.0.4 + 2.1.0 diff --git a/src/AltaSoft.DomainPrimitives.Generator/Executor.cs b/src/AltaSoft.DomainPrimitives.Generator/Executor.cs index 37a1c58..cf409d5 100644 --- a/src/AltaSoft.DomainPrimitives.Generator/Executor.cs +++ b/src/AltaSoft.DomainPrimitives.Generator/Executor.cs @@ -470,6 +470,12 @@ private static void Process(GeneratorData data, string ctorCode, DomainPrimitive else builder.AppendStruct(modifiers, data.ClassName, CreateInheritedInterfaces(data, data.ClassName)); + builder.AppendLine("/// ") + .Append(" public Type GetUnderlyingPrimitiveType() => typeof(").Append(data.PrimitiveTypeFriendlyName).AppendLine(");"); + + builder.AppendLine("/// ") + .Append(" public object GetUnderlyingPrimitiveValue() => (").Append(data.PrimitiveTypeFriendlyName).AppendLine(")this;").NewLine(); + builder.AppendLines(ctorCode); if (needsMathOperators && isByteOrShort) diff --git a/src/AltaSoft.DomainPrimitives/IDomainValue.cs b/src/AltaSoft.DomainPrimitives/IDomainValue.cs index fe5e1f9..5b36cf3 100644 --- a/src/AltaSoft.DomainPrimitives/IDomainValue.cs +++ b/src/AltaSoft.DomainPrimitives/IDomainValue.cs @@ -7,7 +7,8 @@ namespace AltaSoft.DomainPrimitives; /// This interface serves as a foundation for encapsulating and validating domain-specific values. /// /// The type of the domain value. -public interface IDomainValue where T : IEquatable, IComparable, IComparable +public interface IDomainValue : IDomainValue + where T : IEquatable, IComparable, IComparable { /// /// Validates the specified value against domain-specific rules. @@ -27,4 +28,22 @@ public interface IDomainValue where T : IEquatable, IComparable, IComparab /// The domain value to be represented as a string. /// A string representation of the domain value. static virtual string ToString(T value) => value.ToString() ?? string.Empty; -} \ No newline at end of file +} + +/// +/// Represents an interface for domain values. +/// +public interface IDomainValue +{ + /// + /// Gets the underlying primitive type of the domain value. + /// + /// The underlying primitive type of the domain value. + Type GetUnderlyingPrimitiveType(); + + /// + /// Gets the underlying primitive value of the domain value. + /// + /// The underlying primitive value of the domain value. + object GetUnderlyingPrimitiveValue(); +} diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.BoolValue_GeneratesAllInterfacesAndConverters#BoolValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.BoolValue_GeneratesAllInterfacesAndConverters#BoolValue.g.verified.cs index 54e2c76..8472d87 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.BoolValue_GeneratesAllInterfacesAndConverters#BoolValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.BoolValue_GeneratesAllInterfacesAndConverters#BoolValue.g.verified.cs @@ -28,6 +28,11 @@ namespace AltaSoft.DomainPrimitives; , IParsable , IConvertible { + /// + public Type GetUnderlyingPrimitiveType() => typeof(bool); + /// + public object GetUnderlyingPrimitiveValue() => (bool)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly bool _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.ByteValue_GeneratesAllInterfacesAndConverters#ByteValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.ByteValue_GeneratesAllInterfacesAndConverters#ByteValue.g.verified.cs index fc40adb..89d42cd 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.ByteValue_GeneratesAllInterfacesAndConverters#ByteValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.ByteValue_GeneratesAllInterfacesAndConverters#ByteValue.g.verified.cs @@ -32,6 +32,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(byte); + /// + public object GetUnderlyingPrimitiveValue() => (byte)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly byte _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CharValue_GeneratesAllInterfacesAndConverters#CharValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CharValue_GeneratesAllInterfacesAndConverters#CharValue.g.verified.cs index 230a90d..e6d2849 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CharValue_GeneratesAllInterfacesAndConverters#CharValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CharValue_GeneratesAllInterfacesAndConverters#CharValue.g.verified.cs @@ -32,6 +32,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(char); + /// + public object GetUnderlyingPrimitiveValue() => (char)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly char _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateOnlyValue_GeneratesAllInterfacesAndConverters#DateOnlyValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateOnlyValue_GeneratesAllInterfacesAndConverters#DateOnlyValue.g.verified.cs index 3da3c8d..a1a1f24 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateOnlyValue_GeneratesAllInterfacesAndConverters#DateOnlyValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateOnlyValue_GeneratesAllInterfacesAndConverters#DateOnlyValue.g.verified.cs @@ -34,6 +34,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(DateOnly); + /// + public object GetUnderlyingPrimitiveValue() => (DateOnly)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly DateOnly _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateTimeOffsetValue_GeneratesAllInterfacesAndConverters#DateTimeOffsetValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateTimeOffsetValue_GeneratesAllInterfacesAndConverters#DateTimeOffsetValue.g.verified.cs index 112fe15..c2acac1 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateTimeOffsetValue_GeneratesAllInterfacesAndConverters#DateTimeOffsetValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateTimeOffsetValue_GeneratesAllInterfacesAndConverters#DateTimeOffsetValue.g.verified.cs @@ -33,6 +33,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(DateTimeOffset); + /// + public object GetUnderlyingPrimitiveValue() => (DateTimeOffset)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly DateTimeOffset _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateTimeValue_GeneratesAllInterfacesAndConverters#DateTimeValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateTimeValue_GeneratesAllInterfacesAndConverters#DateTimeValue.g.verified.cs index f71a5e2..d32f2cc 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateTimeValue_GeneratesAllInterfacesAndConverters#DateTimeValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DateTimeValue_GeneratesAllInterfacesAndConverters#DateTimeValue.g.verified.cs @@ -33,6 +33,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(DateTime); + /// + public object GetUnderlyingPrimitiveValue() => (DateTime)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly DateTime _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DecimalValue_GeneratesAllInterfacesAndConverters#DecimalValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DecimalValue_GeneratesAllInterfacesAndConverters#DecimalValue.g.verified.cs index 65136d9..46c398c 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DecimalValue_GeneratesAllInterfacesAndConverters#DecimalValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DecimalValue_GeneratesAllInterfacesAndConverters#DecimalValue.g.verified.cs @@ -37,6 +37,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(decimal); + /// + public object GetUnderlyingPrimitiveValue() => (decimal)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly decimal _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DoubleValue_GeneratesAllInterfacesAndConverters#DoubleValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DoubleValue_GeneratesAllInterfacesAndConverters#DoubleValue.g.verified.cs index 3fbc6e1..dd1670f 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DoubleValue_GeneratesAllInterfacesAndConverters#DoubleValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.DoubleValue_GeneratesAllInterfacesAndConverters#DoubleValue.g.verified.cs @@ -37,6 +37,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(double); + /// + public object GetUnderlyingPrimitiveValue() => (double)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly double _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.FloatValue_GeneratesAllInterfacesAndConverters#FloatValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.FloatValue_GeneratesAllInterfacesAndConverters#FloatValue.g.verified.cs index 50718cf..2b3573d 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.FloatValue_GeneratesAllInterfacesAndConverters#FloatValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.FloatValue_GeneratesAllInterfacesAndConverters#FloatValue.g.verified.cs @@ -37,6 +37,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(float); + /// + public object GetUnderlyingPrimitiveValue() => (float)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly float _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.GuidValue_GeneratesAllInterfacesAndConverters#GuidValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.GuidValue_GeneratesAllInterfacesAndConverters#GuidValue.g.verified.cs index 279b3e4..b9b6e79 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.GuidValue_GeneratesAllInterfacesAndConverters#GuidValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.GuidValue_GeneratesAllInterfacesAndConverters#GuidValue.g.verified.cs @@ -31,6 +31,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(Guid); + /// + public object GetUnderlyingPrimitiveValue() => (Guid)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly Guid _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.Int16Value_GeneratesAllInterfacesAndConverters#ShortValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.Int16Value_GeneratesAllInterfacesAndConverters#ShortValue.g.verified.cs index df655a4..74c1510 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.Int16Value_GeneratesAllInterfacesAndConverters#ShortValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.Int16Value_GeneratesAllInterfacesAndConverters#ShortValue.g.verified.cs @@ -32,6 +32,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(short); + /// + public object GetUnderlyingPrimitiveValue() => (short)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly short _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntOfIntValue_GeneratesAllInterfacesAndConverters#IntOfIntValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntOfIntValue_GeneratesAllInterfacesAndConverters#IntOfIntValue.g.verified.cs index 7240ce2..4e3474b 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntOfIntValue_GeneratesAllInterfacesAndConverters#IntOfIntValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntOfIntValue_GeneratesAllInterfacesAndConverters#IntOfIntValue.g.verified.cs @@ -35,6 +35,11 @@ namespace AltaSoft.DomainPrimitives; , IParsable , IConvertible { + /// + public Type GetUnderlyingPrimitiveType() => typeof(int); + /// + public object GetUnderlyingPrimitiveValue() => (int)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly IntValue _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntOfIntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntOfIntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs index 279a98e..5010f3b 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntOfIntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntOfIntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs @@ -37,6 +37,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(int); + /// + public object GetUnderlyingPrimitiveValue() => (int)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly int _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs index 279a98e..5010f3b 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.IntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs @@ -37,6 +37,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(int); + /// + public object GetUnderlyingPrimitiveValue() => (int)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly int _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.LongValue_GeneratesAllInterfacesAndConverters#LongValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.LongValue_GeneratesAllInterfacesAndConverters#LongValue.g.verified.cs index 44d5389..fb43ce5 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.LongValue_GeneratesAllInterfacesAndConverters#LongValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.LongValue_GeneratesAllInterfacesAndConverters#LongValue.g.verified.cs @@ -37,6 +37,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(long); + /// + public object GetUnderlyingPrimitiveValue() => (long)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly long _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.SByteValue_GeneratesAllInterfacesAndConverters#SByteValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.SByteValue_GeneratesAllInterfacesAndConverters#SByteValue.g.verified.cs index 408fa48..4ca15e6 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.SByteValue_GeneratesAllInterfacesAndConverters#SByteValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.SByteValue_GeneratesAllInterfacesAndConverters#SByteValue.g.verified.cs @@ -32,6 +32,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(sbyte); + /// + public object GetUnderlyingPrimitiveValue() => (sbyte)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly sbyte _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringOfStringValue_GeneratesAllInterfacesAndConverters#StringOfStringValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringOfStringValue_GeneratesAllInterfacesAndConverters#StringOfStringValue.g.verified.cs index e01e68b..2d2975c 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringOfStringValue_GeneratesAllInterfacesAndConverters#StringOfStringValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringOfStringValue_GeneratesAllInterfacesAndConverters#StringOfStringValue.g.verified.cs @@ -29,6 +29,11 @@ public partial class StringOfStringValue : IEquatable , IParsable , IConvertible { + /// + public Type GetUnderlyingPrimitiveType() => typeof(string); + /// + public object GetUnderlyingPrimitiveValue() => (string)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly StringValue _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringOfStringValue_GeneratesAllInterfacesAndConverters#StringValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringOfStringValue_GeneratesAllInterfacesAndConverters#StringValue.g.verified.cs index 827b2a8..1cb67a1 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringOfStringValue_GeneratesAllInterfacesAndConverters#StringValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringOfStringValue_GeneratesAllInterfacesAndConverters#StringValue.g.verified.cs @@ -28,6 +28,11 @@ public partial class StringValue : IEquatable , IParsable , IConvertible { + /// + public Type GetUnderlyingPrimitiveType() => typeof(string); + /// + public object GetUnderlyingPrimitiveValue() => (string)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly string _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringValue_GeneratesAllInterfacesAndConverters#StringValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringValue_GeneratesAllInterfacesAndConverters#StringValue.g.verified.cs index 827b2a8..1cb67a1 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringValue_GeneratesAllInterfacesAndConverters#StringValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.StringValue_GeneratesAllInterfacesAndConverters#StringValue.g.verified.cs @@ -28,6 +28,11 @@ public partial class StringValue : IEquatable , IParsable , IConvertible { + /// + public Type GetUnderlyingPrimitiveType() => typeof(string); + /// + public object GetUnderlyingPrimitiveValue() => (string)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly string _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.TimeOnlyValue_GeneratesAllInterfacesAndConverters#TimeOnlyValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.TimeOnlyValue_GeneratesAllInterfacesAndConverters#TimeOnlyValue.g.verified.cs index 0165dce..7ec2bbb 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.TimeOnlyValue_GeneratesAllInterfacesAndConverters#TimeOnlyValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.TimeOnlyValue_GeneratesAllInterfacesAndConverters#TimeOnlyValue.g.verified.cs @@ -34,6 +34,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(TimeOnly); + /// + public object GetUnderlyingPrimitiveValue() => (TimeOnly)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly TimeOnly _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.TimeSpanValue_GeneratesAllInterfacesAndConverters#TimeSpanValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.TimeSpanValue_GeneratesAllInterfacesAndConverters#TimeSpanValue.g.verified.cs index f7f821b..f307d49 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.TimeSpanValue_GeneratesAllInterfacesAndConverters#TimeSpanValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.TimeSpanValue_GeneratesAllInterfacesAndConverters#TimeSpanValue.g.verified.cs @@ -33,6 +33,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(TimeSpan); + /// + public object GetUnderlyingPrimitiveValue() => (TimeSpan)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly TimeSpan _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.UInt16Value_GeneratesAllInterfacesAndConverters#UShortValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.UInt16Value_GeneratesAllInterfacesAndConverters#UShortValue.g.verified.cs index f697258..a9b78ca 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.UInt16Value_GeneratesAllInterfacesAndConverters#UShortValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.UInt16Value_GeneratesAllInterfacesAndConverters#UShortValue.g.verified.cs @@ -32,6 +32,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(ushort); + /// + public object GetUnderlyingPrimitiveValue() => (ushort)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly ushort _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.UIntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.UIntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs index ce5ef89..376edce 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.UIntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.UIntValue_GeneratesAllInterfacesAndConverters#IntValue.g.verified.cs @@ -37,6 +37,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(uint); + /// + public object GetUnderlyingPrimitiveValue() => (uint)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly uint _value; diff --git a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.ULongValue_GeneratesAllInterfacesAndConverters#LongValue.g.verified.cs b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.ULongValue_GeneratesAllInterfacesAndConverters#LongValue.g.verified.cs index 912be42..49c2b88 100644 --- a/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.ULongValue_GeneratesAllInterfacesAndConverters#LongValue.g.verified.cs +++ b/tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.ULongValue_GeneratesAllInterfacesAndConverters#LongValue.g.verified.cs @@ -37,6 +37,11 @@ namespace AltaSoft.DomainPrimitives; , IUtf8SpanFormattable #endif { + /// + public Type GetUnderlyingPrimitiveType() => typeof(ulong); + /// + public object GetUnderlyingPrimitiveValue() => (ulong)this; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly ulong _value;