ptupitsyn commented on code in PR #1482:
URL: https://github.com/apache/ignite-3/pull/1482#discussion_r1058441152
##########
modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/BinaryTupleMethods.cs:
##########
@@ -176,34 +176,36 @@ internal static class BinaryTupleMethods
/// <summary>
/// Gets the write method.
/// </summary>
- /// <param name="valueType">Type of the value to write.</param>
+ /// <param name="type">Type of the value to write.</param>
/// <returns>Write method for the specified value type.</returns>
- public static MethodInfo GetWriteMethod(Type valueType) =>
- WriteMethods.TryGetValue(valueType, out var method) ? method :
throw GetUnsupportedTypeException(valueType);
+ public static MethodInfo GetWriteMethod(Type type) =>
+ WriteMethods.TryGetValue(Unwrap(type), out var method) ? method :
throw GetUnsupportedTypeException(type);
/// <summary>
/// Gets the write method.
/// </summary>
- /// <param name="valueType">Type of the value to write.</param>
+ /// <param name="type">Type of the value to write.</param>
/// <returns>Write method for the specified value type.</returns>
- public static MethodInfo? GetWriteMethodOrNull(Type valueType) =>
WriteMethods.GetValueOrDefault(valueType);
+ public static MethodInfo? GetWriteMethodOrNull(Type type) =>
WriteMethods.GetValueOrDefault(Unwrap(type));
/// <summary>
/// Gets the read method.
/// </summary>
- /// <param name="valueType">Type of the value to read.</param>
+ /// <param name="type">Type of the value to read.</param>
/// <returns>Read method for the specified value type.</returns>
- public static MethodInfo GetReadMethod(Type valueType) =>
- ReadMethods.TryGetValue(valueType, out var method) ? method :
throw GetUnsupportedTypeException(valueType);
+ public static MethodInfo GetReadMethod(Type type) =>
+ ReadMethods.TryGetValue(Unwrap(type), out var method) ? method :
throw GetUnsupportedTypeException(type);
/// <summary>
/// Gets the read method.
/// </summary>
- /// <param name="valueType">Type of the value to read.</param>
+ /// <param name="type">Type of the value to read.</param>
/// <returns>Read method for the specified value type.</returns>
- public static MethodInfo? GetReadMethodOrNull(Type valueType) =>
ReadMethods.GetValueOrDefault(valueType);
+ public static MethodInfo? GetReadMethodOrNull(Type type) =>
ReadMethods.GetValueOrDefault(Unwrap(type));
private static IgniteClientException GetUnsupportedTypeException(Type
valueType) =>
new(ErrorGroups.Client.Configuration, "Unsupported type: " +
valueType);
+
+ private static Type Unwrap(Type type) => type.IsEnum ?
Enum.GetUnderlyingType(type) : type;
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]