diff --git a/src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs b/src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs index 8e74d9da3d5..a7f02d96900 100644 --- a/src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs +++ b/src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs @@ -77,9 +77,21 @@ public static (Expression> WhereExpression, int Offset) BuildWhere { var handledKey = handled[j]; - keyExpr = Expression.Equal( - Expression.Call(ReplaceParameter(handledKey.Expression, parameter), handledKey.CompareMethod, - cursorExpr[j]), zero); + if (handledKey.Expression.ReturnType.IsEnum) + { + keyExpr = Expression.Equal( + ReplaceParameter(handledKey.Expression, parameter), + cursorExpr[j]); + } + else + { + keyExpr = Expression.Equal( + Expression.Call( + ReplaceParameter(handledKey.Expression, parameter), + handledKey.CompareMethod, + cursorExpr[j]), + zero); + } current = current is null ? keyExpr : Expression.AndAlso(current, keyExpr); } @@ -88,13 +100,36 @@ public static (Expression> WhereExpression, int Offset) BuildWhere ? key.Direction == CursorKeyDirection.Ascending : key.Direction == CursorKeyDirection.Descending; - keyExpr = greaterThan - ? Expression.GreaterThan( - Expression.Call(ReplaceParameter(key.Expression, parameter), key.CompareMethod, cursorExpr[i]), - zero) - : Expression.LessThan( - Expression.Call(ReplaceParameter(key.Expression, parameter), key.CompareMethod, cursorExpr[i]), - zero); + if (key.Expression.ReturnType.IsEnum) + { + var underlyingType = Enum.GetUnderlyingType(key.Expression.ReturnType); + + keyExpr = greaterThan + ? Expression.GreaterThan( + Expression.Convert( + ReplaceParameter(key.Expression, parameter), underlyingType), + Expression.Convert(cursorExpr[i], underlyingType)) + : Expression.LessThan( + Expression.Convert( + ReplaceParameter(key.Expression, parameter), underlyingType), + Expression.Convert(cursorExpr[i], underlyingType)); + } + else + { + keyExpr = greaterThan + ? Expression.GreaterThan( + Expression.Call( + ReplaceParameter(key.Expression, parameter), + key.CompareMethod, + cursorExpr[i]), + zero) + : Expression.LessThan( + Expression.Call( + ReplaceParameter(key.Expression, parameter), + key.CompareMethod, + cursorExpr[i]), + zero); + } current = current is null ? keyExpr : Expression.AndAlso(current, keyExpr); expression = expression is null ? current : Expression.OrElse(expression, current); diff --git a/src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKeySerializerRegistration.cs b/src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKeySerializerRegistration.cs index 4afb644a8a8..8fb6c10f240 100644 --- a/src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKeySerializerRegistration.cs +++ b/src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKeySerializerRegistration.cs @@ -26,7 +26,15 @@ public static class CursorKeySerializerRegistration new BoolCursorKeySerializer(), new UShortCursorKeySerializer(), new UIntCursorKeySerializer(), - new ULongCursorKeySerializer() + new ULongCursorKeySerializer(), + new EnumCursorKeySerializer(), + new EnumCursorKeySerializer(), + new EnumCursorKeySerializer(), + new EnumCursorKeySerializer(), + new EnumCursorKeySerializer(), + new EnumCursorKeySerializer(), + new EnumCursorKeySerializer(), + new EnumCursorKeySerializer() ]; /// diff --git a/src/GreenDonut/src/GreenDonut.Data/Cursors/Serializers/EnumCursorKeySerializer.cs b/src/GreenDonut/src/GreenDonut.Data/Cursors/Serializers/EnumCursorKeySerializer.cs new file mode 100644 index 00000000000..186bf347479 --- /dev/null +++ b/src/GreenDonut/src/GreenDonut.Data/Cursors/Serializers/EnumCursorKeySerializer.cs @@ -0,0 +1,60 @@ +using System.Buffers.Text; +using System.Numerics; +using System.Reflection; + +namespace GreenDonut.Data.Cursors.Serializers; + +internal sealed class EnumCursorKeySerializer : ICursorKeySerializer where T : struct, INumber +{ + private static readonly MethodInfo _compareTo = CompareToResolver.GetCompareToMethod(); + + public bool IsSupported(Type type) + => type.IsEnum && Enum.GetUnderlyingType(type) == typeof(T); + + public MethodInfo GetCompareToMethod(Type type) + => _compareTo; + + public object Parse(ReadOnlySpan formattedKey) + { + var t = typeof(T); + + return t switch + { + _ when t == typeof(byte) && Utf8Parser.TryParse(formattedKey, out byte b, out _) + => b, + _ when t == typeof(sbyte) && Utf8Parser.TryParse(formattedKey, out sbyte sb, out _) + => sb, + _ when t == typeof(short) && Utf8Parser.TryParse(formattedKey, out short s, out _) + => s, + _ when t == typeof(ushort) && Utf8Parser.TryParse(formattedKey, out ushort us, out _) + => us, + _ when t == typeof(int) && Utf8Parser.TryParse(formattedKey, out int i, out _) + => i, + _ when t == typeof(uint) && Utf8Parser.TryParse(formattedKey, out uint ui, out _) + => ui, + _ when t == typeof(long) && Utf8Parser.TryParse(formattedKey, out long l, out _) + => l, + _ when t == typeof(ulong) && Utf8Parser.TryParse(formattedKey, out ulong ul, out _) + => ul, + _ => throw new InvalidOperationException("Unsupported enum type.") + }; + } + + public bool TryFormat(object key, Span buffer, out int written) + { + var t = typeof(T); + + return t switch + { + _ when t == typeof(byte) => Utf8Formatter.TryFormat((byte)key, buffer, out written), + _ when t == typeof(sbyte) => Utf8Formatter.TryFormat((sbyte)key, buffer, out written), + _ when t == typeof(short) => Utf8Formatter.TryFormat((short)key, buffer, out written), + _ when t == typeof(ushort) => Utf8Formatter.TryFormat((ushort)key, buffer, out written), + _ when t == typeof(int) => Utf8Formatter.TryFormat((int)key, buffer, out written), + _ when t == typeof(uint) => Utf8Formatter.TryFormat((uint)key, buffer, out written), + _ when t == typeof(long) => Utf8Formatter.TryFormat((long)key, buffer, out written), + _ when t == typeof(ulong) => Utf8Formatter.TryFormat((ulong)key, buffer, out written), + _ => throw new InvalidOperationException("Unsupported enum type.") + }; + } +} diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/PagingHelperTests.cs b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/PagingHelperTests.cs index 147e2efaef8..7c4bd57482a 100644 --- a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/PagingHelperTests.cs +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/PagingHelperTests.cs @@ -416,7 +416,15 @@ public async Task Fetch_First_2_Items_Second_Page_Descending_AllTypes() { "TimeOnly", context.Tests.OrderByDescending(t => t.TimeOnly) }, { "UInt", context.Tests.OrderByDescending(t => t.UInt) }, { "ULong", context.Tests.OrderByDescending(t => t.ULong) }, - { "UShort", context.Tests.OrderByDescending(t => t.UShort) } + { "UShort", context.Tests.OrderByDescending(t => t.UShort) }, + { "ByteEnum", context.Tests.OrderByDescending(t => t.ByteEnum) }, + { "SbyteEnum", context.Tests.OrderByDescending(t => t.SbyteEnum) }, + { "ShortEnum", context.Tests.OrderByDescending(t => t.ShortEnum) }, + { "UshortEnum", context.Tests.OrderByDescending(t => t.UshortEnum) }, + { "IntEnum", context.Tests.OrderByDescending(t => t.IntEnum) }, + { "UintEnum", context.Tests.OrderByDescending(t => t.UintEnum) }, + { "LongEnum", context.Tests.OrderByDescending(t => t.LongEnum) }, + { "UlongEnum", context.Tests.OrderByDescending(t => t.UlongEnum) } }; // Act @@ -434,7 +442,16 @@ public async Task Fetch_First_2_Items_Second_Page_Descending_AllTypes() } // Assert - pages.MatchMarkdownSnapshot(); + pages.ToDictionary( + p => p.Key, + p => + p.Value.Select( + t => + new + { + t.Id, + Value = t.GetType().GetProperty(p.Key)?.GetValue(t) + })).MatchMarkdownSnapshot(); } private static async Task SeedAsync(string connectionString) @@ -475,19 +492,19 @@ private static async Task SeedTestAsync(string connectionString) await using var context = new CatalogContext(connectionString); await context.Database.EnsureCreatedAsync(); - for (var i = 1; i <= 10; i++) + for (var i = 1; i <= 8; i++) { var test = new Test { Id = i, - Bool = i % 2 == 0, + Bool = i > 4, DateOnly = DateOnly.FromDateTime(DateTime.UnixEpoch.AddDays(i - 1)), DateTime = DateTime.UnixEpoch.AddDays(i - 1), DateTimeOffset = DateTimeOffset.UnixEpoch.AddDays(i - 1), Decimal = i, Double = i, Float = i, - Guid = Guid.ParseExact($"0000000000000000000000000000000{i - 1}", "N"), + Guid = Guid.ParseExact($"0000000000000000000000000000000{i}", "N"), Int = i, Long = i, Short = (short)i, @@ -496,7 +513,15 @@ private static async Task SeedTestAsync(string connectionString) TimeSpan = TimeSpan.FromHours(i), UInt = (uint)i, ULong = (ulong)i, - UShort = (ushort)i + UShort = (ushort)i, + ByteEnum = i > 4 ? TestByteEnum.Two : TestByteEnum.One, + SbyteEnum = i > 4 ? TestSbyteEnum.Two : TestSbyteEnum.One, + ShortEnum = i > 4 ? TestShortEnum.Two : TestShortEnum.One, + UshortEnum = i > 4 ? TestUshortEnum.Two : TestUshortEnum.One, + IntEnum = i > 4 ? TestIntEnum.Two : TestIntEnum.One, + UintEnum = i > 4 ? TestUintEnum.Two : TestUintEnum.One, + LongEnum = i > 4 ? TestLongEnum.Two : TestLongEnum.One, + UlongEnum = i > 4 ? TestUlongEnum.Two : TestUlongEnum.One }; context.Tests.Add(test); diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/Test.cs b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/Test.cs index 4717d18bfb6..538d18636dd 100644 --- a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/Test.cs +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/Test.cs @@ -37,4 +37,68 @@ public class Test public ulong ULong { get; set; } public ushort UShort { get; set; } + + public TestByteEnum ByteEnum { get; set; } + + public TestSbyteEnum SbyteEnum { get; set; } + + public TestShortEnum ShortEnum { get; set; } + + public TestUshortEnum UshortEnum { get; set; } + + public TestIntEnum IntEnum { get; set; } + + public TestUintEnum UintEnum { get; set; } + + public TestLongEnum LongEnum { get; set; } + + public TestUlongEnum UlongEnum { get; set; } +} + +public enum TestByteEnum : byte +{ + One = 1, + Two = 2 +} + +public enum TestSbyteEnum : sbyte +{ + One = 1, + Two = 2 +} + +public enum TestShortEnum : short +{ + One = 1, + Two = 2 +} + +public enum TestUshortEnum : ushort +{ + One = 1, + Two = 2 +} + +public enum TestIntEnum +{ + One = 1, + Two = 2 +} + +public enum TestUintEnum : uint +{ + One = 1, + Two = 2 +} + +public enum TestLongEnum : long +{ + One = 1, + Two = 2 +} + +public enum TestUlongEnum : ulong +{ + One = 1, + Two = 2 } diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/PagingHelperTests.Fetch_First_2_Items_Second_Page_Descending_AllTypes.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/PagingHelperTests.Fetch_First_2_Items_Second_Page_Descending_AllTypes.md index 382a2404eff..4398d9586da 100644 --- a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/PagingHelperTests.Fetch_First_2_Items_Second_Page_Descending_AllTypes.md +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/PagingHelperTests.Fetch_First_2_Items_Second_Page_Descending_AllTypes.md @@ -5,673 +5,241 @@ "Bool": [ { "Id": 6, - "Bool": true, - "DateOnly": "1970-01-06", - "DateTime": "1970-01-06T00:00:00Z", - "DateTimeOffset": "1970-01-06T00:00:00+00:00", - "Decimal": 6.0, - "Double": 6.0, - "Float": 6.0, - "Guid": "00000000-0000-0000-0000-000000000005", - "Int": 6, - "Long": 6, - "Short": 6, - "String": "6", - "TimeOnly": "06:00:00", - "TimeSpan": "06:00:00", - "UInt": 6, - "ULong": 6, - "UShort": 6 + "Value": true }, { - "Id": 4, - "Bool": true, - "DateOnly": "1970-01-04", - "DateTime": "1970-01-04T00:00:00Z", - "DateTimeOffset": "1970-01-04T00:00:00+00:00", - "Decimal": 4.0, - "Double": 4.0, - "Float": 4.0, - "Guid": "00000000-0000-0000-0000-000000000003", - "Int": 4, - "Long": 4, - "Short": 4, - "String": "4", - "TimeOnly": "04:00:00", - "TimeSpan": "04:00:00", - "UInt": 4, - "ULong": 4, - "UShort": 4 + "Id": 5, + "Value": true } ], "DateOnly": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": "1970-01-06" }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": "1970-01-05" } ], "DateTime": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": "1970-01-06T00:00:00Z" }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": "1970-01-05T00:00:00Z" } ], "DateTimeOffset": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": "1970-01-06T00:00:00+00:00" }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": "1970-01-05T00:00:00+00:00" } ], "Decimal": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": 6.0 }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": 5.0 } ], "Double": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": 6.0 }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": 5.0 } ], "Float": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": 6.0 }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": 5.0 } ], "Guid": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": "00000000-0000-0000-0000-000000000006" }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": "00000000-0000-0000-0000-000000000005" } ], "Int": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": 6 }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": 5 } ], "Long": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": 6 }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": 5 } ], "Short": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": 6 }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": 5 } ], "String": [ { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 6, + "Value": "6" }, { - "Id": 6, - "Bool": true, - "DateOnly": "1970-01-06", - "DateTime": "1970-01-06T00:00:00Z", - "DateTimeOffset": "1970-01-06T00:00:00+00:00", - "Decimal": 6.0, - "Double": 6.0, - "Float": 6.0, - "Guid": "00000000-0000-0000-0000-000000000005", - "Int": 6, - "Long": 6, - "Short": 6, - "String": "6", - "TimeOnly": "06:00:00", - "TimeSpan": "06:00:00", - "UInt": 6, - "ULong": 6, - "UShort": 6 + "Id": 5, + "Value": "5" } ], "TimeOnly": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": "06:00:00" }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": "05:00:00" } ], "UInt": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": 6 }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": 5 } ], "ULong": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": 6 }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": 5 } ], "UShort": [ { - "Id": 8, - "Bool": true, - "DateOnly": "1970-01-08", - "DateTime": "1970-01-08T00:00:00Z", - "DateTimeOffset": "1970-01-08T00:00:00+00:00", - "Decimal": 8.0, - "Double": 8.0, - "Float": 8.0, - "Guid": "00000000-0000-0000-0000-000000000007", - "Int": 8, - "Long": 8, - "Short": 8, - "String": "8", - "TimeOnly": "08:00:00", - "TimeSpan": "08:00:00", - "UInt": 8, - "ULong": 8, - "UShort": 8 + "Id": 6, + "Value": 6 + }, + { + "Id": 5, + "Value": 5 + } + ], + "ByteEnum": [ + { + "Id": 6, + "Value": "Two" + }, + { + "Id": 5, + "Value": "Two" + } + ], + "SbyteEnum": [ + { + "Id": 6, + "Value": "Two" + }, + { + "Id": 5, + "Value": "Two" + } + ], + "ShortEnum": [ + { + "Id": 6, + "Value": "Two" + }, + { + "Id": 5, + "Value": "Two" + } + ], + "UshortEnum": [ + { + "Id": 6, + "Value": "Two" + }, + { + "Id": 5, + "Value": "Two" + } + ], + "IntEnum": [ + { + "Id": 6, + "Value": "Two" + }, + { + "Id": 5, + "Value": "Two" + } + ], + "UintEnum": [ + { + "Id": 6, + "Value": "Two" + }, + { + "Id": 5, + "Value": "Two" + } + ], + "LongEnum": [ + { + "Id": 6, + "Value": "Two" + }, + { + "Id": 5, + "Value": "Two" + } + ], + "UlongEnum": [ + { + "Id": 6, + "Value": "Two" }, { - "Id": 7, - "Bool": false, - "DateOnly": "1970-01-07", - "DateTime": "1970-01-07T00:00:00Z", - "DateTimeOffset": "1970-01-07T00:00:00+00:00", - "Decimal": 7.0, - "Double": 7.0, - "Float": 7.0, - "Guid": "00000000-0000-0000-0000-000000000006", - "Int": 7, - "Long": 7, - "Short": 7, - "String": "7", - "TimeOnly": "07:00:00", - "TimeSpan": "07:00:00", - "UInt": 7, - "ULong": 7, - "UShort": 7 + "Id": 5, + "Value": "Two" } ] }