ptupitsyn commented on code in PR #1482:
URL: https://github.com/apache/ignite-3/pull/1482#discussion_r1058444854
##########
modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/ObjectSerializerHandler.cs:
##########
@@ -500,11 +500,13 @@ private static void EmitFieldRead(FieldInfo? fieldInfo,
ILGenerator il, Column c
private static void ValidateFieldType(FieldInfo fieldInfo, Column
column)
{
var columnType = column.Type.ToType();
+
var fieldType = Nullable.GetUnderlyingType(fieldInfo.FieldType) ??
fieldInfo.FieldType;
+ fieldType = fieldType.IsEnum ? Enum.GetUnderlyingType(fieldType) :
fieldType;
if (fieldType != columnType)
{
- var message = $"Can't map field
'{fieldInfo.DeclaringType?.Name}.{fieldInfo.Name}' of type '{fieldType}' " +
+ var message = $"Can't map field
'{fieldInfo.DeclaringType?.Name}.{fieldInfo.Name}' of type
'{fieldInfo.FieldType}' " +
Review Comment:
In this case the issue is not about unsupported type, but about type
mismatch.
Unlike Ignite 2.x, you can't put an arbitrary object into the table (cache).
First, you create a table with SQL. Then you can map a class to that table. And
if you make a mistake with field types, you'll get a message like "Can't map
int field 'foo' to string column 'foo'". So you go ahead and change the field
type. No need to check the docs.
--
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]