Hi Raymond,
Yes, you can do that by implementing IBinarySerializer like this:
class BinarizableSerializer : IBinarySerializer
{
public void WriteBinary(object obj, IBinaryWriter writer)
{
if (obj is IBinarizable bin)
{
bin.WriteBinary(writer);
}
throw new Exception("Not IBinarizable: " + obj.GetType());
}
public void ReadBinary(object obj, IBinaryReader reader)
{
if (obj is IBinarizable bin)
{
bin.ReadBinary(reader);
}
throw new Exception("Not IBinarizable: " + obj.GetType());
}
}
Then set it globally in IgniteConfiguration:
var cfg = new IgniteConfiguration
{
BinaryConfiguration = new BinaryConfiguration
{
Serializer = new BinarizableSerializer()
}
};
On Thu, Nov 8, 2018 at 9:28 PM Raymond Wilson <[email protected]>
wrote:
> Hi Denis,
>
> Yes, I understand reflective serialisation uses binarizable serialisation
> under the hood (and it's fast and easy to use). But it has issues in the
> face of schema changes so it is better (and recommended in the Ignite docs)
> to use Binarizable serialization for production.
>
> I want to make sure all my serialization contexts are covered by explicit
> IBinarizable serialization. A simple approach would be to turn off
> reflective serialization to ensure cases where we have missed it fail
> explicitly. Is that possible?
>
> Thanks,
> Raymond.
>
>
> On Thu, Nov 8, 2018 at 1:10 PM Denis Magda <[email protected]> wrote:
>
>> Hi Raymond,
>>
>> If to believe this page, the reflective serialization converts an object
>> to the binary format (sort of marked with IBaniralizable interface
>> implicitly):
>>
>> https://apacheignite-net.readme.io/docs/serialization#section-ignite-reflective-serialization
>>
>> --
>> Denis
>>
>>
>> On Tue, Nov 6, 2018 at 1:01 PM Raymond Wilson <[email protected]>
>> wrote:
>>
>>> We are currently converting our use of Ignite reflective serialisation
>>> to use IBinarizable based serialisation [using Ignite 2.6 with c# client]
>>>
>>> What I would like to do is enforce a policy of not using reflective
>>> serialisation to ensure we have all the bases covered.
>>>
>>> Is there a way to do this in Ignite?
>>>
>>> Thanks,
>>> Raymond.
>>>
>>>