Robert May created IGNITE-14947:
-----------------------------------

             Summary: QuerySqlFieldAttribute isn't honored when writing records
                 Key: IGNITE-14947
                 URL: https://issues.apache.org/jira/browse/IGNITE-14947
             Project: Ignite
          Issue Type: Bug
          Components: platforms, sql, thin client
    Affects Versions: 2.9.1, 2.10
            Reporter: Robert May


Consider the following POCO:


{code:c#}
public class MyPoco
{
    [QuerySqlField(indexed = true)
    public string Value1 { get; set; }

    [QuerySqlField(Name = "Different")
    public string Value2 { get; set; }
}
{code}

When used in the query entities to create the cache and the sql table, the 
attribute is correctly honored and a table will be created with fields Value1 
and Different.

However, when you call 
{code:c#}
    var pocoInstance = new MyPoco() { Value1 = "1", Value2 = "2" }
    cache.Put("mykey", pocoInstance);
{code}

The value in Value2 will not be written into the cache.

This happens because when BinaryReflectiveSerializerInternal.Register is called 
for the type, it only considers the field names (and auto property field names) 
on the type, but never looks for the QuerySqlField attribute to see if the 
field has been renamed.

This will mean looking at the properties as well as the fields for attributes 
in the Register method to determine renames.

Note that this works as expected in the java client.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to