The config above sets nameMapper for Java.
Instead, you have to set it on .NET (C#) side. Full working example:

using System;
using System.Linq;
using Apache.Ignite.Core;
using Apache.Ignite.Core.Binary;

namespace simple_name_mapper
{
    class Program
    {
        static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                BinaryConfiguration = new BinaryConfiguration
                {
                    NameMapper = new BinaryBasicNameMapper
                    {
                        IsSimpleName = true
                    }
                }
            };

            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetOrCreateCache<int, Foo>("c");
                cache[1] = new Foo {Bar = 2};

                var binaryType = ignite.GetBinary().GetBinaryTypes().Single();
                Console.WriteLine(binaryType.TypeName); // Prints
"Foo" (without namespace and parent class)
            }
        }

        class Foo
        {
            public int Bar;
        }
    }
}


On Mon, Oct 14, 2019 at 1:26 PM Igor Sapego <[email protected]> wrote:

> Hello,
>
> It's strange, we have tested it and it should work.
>
> Are you sure, the right config is used by all nodes?
>
> Best Regards,
> Igor
>
>
> On Sun, Oct 13, 2019 at 6:10 PM 朱靓 <[email protected]> wrote:
>
>> Hi
>>    I am new to Ignite, and i will use C# save cache and fetch with python
>> and C++. After read the doc , i use the config with simple name to avoid
>> strange thing of namespace. But it seems not effect. I set simpleName to
>> true. But in Ignite, it saves objects with full name.
>> We can see the class name PanoControls.Views.V2XVehicleParaView is full
>> name not simple name, in my think, if we set simpleName to true, ignite
>> should save with name V2XVehicleParaView.
>>
>> Could anyone help?
>> Below list config and ignite data.
>>
>> Config:
>>
>>           <property name="nameMapper">
>>             <bean class="org.apache.ignite.binary.BinaryBasicNameMapper">
>>               <property name="simpleName" value="true"/>
>>             </bean>
>>           </property>
>>
>> Data in Ignite
>>
>> visor> cache -scan -c=PanoSenarioFrameCache
>> Entries in  cache: PanoSenarioFrameCache
>>
>> +==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+
>> |    Key Class     |    Key     |           Value Class           |
>>
>>
>>
>>
>>                                                              Value
>>
>>
>>
>>
>>                                                           |
>>
>> +==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+
>> | java.lang.String | V2XVehicle | o.a.i.i.binary.BinaryObjectImpl |
>> PanoControls.Views.V2XVehicleParaView [hash=-1087297976,
>> ActivateTheTurnSignalProperty=PanoControls.Views.V2XVehicleParaView+ActivateTheTurnSignal
>> [ordinal=0], RangeRadius=0,
>> ActivateEmergencyBrakeProperty=PanoControls.Views.V2XVehicleParaView+ActivateEmergencyBrake
>> [ordinal=0],
>> EmergencyVehicleProperty=PanoControls.Views.V2XVehicleParaView+EmergencyVehicle
>> [ordinal=0], PacketLossRate=12.0, AverageDelay=0, Frequency=0.0,
>> OutOfControlVehicleProperty=System.Collections.Generic.List`1[[PanoControls.Views.V2XVehicleParaView+OutOfControlVehicle]]
>> [idHash=353470994, hash=1983113259, _size=0, _items=[, _version=0],
>> CurrentParentNameProperty=runVeh,
>> ActivateFaultLightProperty=PanoControls.Views.V2XVehicleParaView+ActivateFaultLight
>> [ordinal=0]] |
>>
>> +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
>> visor>
>>
>

Reply via email to