Thanks Pavel, i tried with method you provided, it works. The class name will
not including namespace
It seems C# xml loader has some issue and the config of simple name will not
take effect.
We can use workaround like this.
below is class name with simple class
| java.lang.String | fd9f8027-dd26-422e-bfec-bb35e46c9b46 |
o.a.i.i.binary.BinaryObjectImpl | V2XVehicle [hash=-40414514,
ActivateEmergencyBrakeProperty=ActivateEmergencyBrake [ordinal=0],
ActivateFaultLightProperty=ActivateFaultLight [ordinal=0],
ActivateTheTurnSignalProperty=ActivateTheTurnSignal [ordinal=0],
AverageDelay=0, CurrentParentUIDProperty=fd9f8027-dd26-422e-bfec-bb35e46c9b46,
EmergencyVehicleProperty=EmergencyVehicle [ordinal=2], Frequency=0.0,
OutOfControlVehicleProperty=List`1[[OutOfControlVehicle]] [idHash=328106431,
hash=932129604, _items=[OutOfControlVehicle [ordinal=0], OutOfControlVehicle
[ordinal=1], OutOfControlVehicle [ordinal=2], OutOfControlVehicle [ordinal=5],
OutOfControlVehicle [ordinal=3], OutOfControlVehicle [ordinal=0],
OutOfControlVehicle [ordinal=0], OutOfControlVehicle [ordinal=0], _size=5,
_version=5], PacketLossRate=22.0, RangeRadius=0] |
liang zhu
From: Pavel Tupitsyn
Date: 2019-10-14 19:38
To: user
Subject: Re: Ignite support for config BinaryBasicNameMapper with simpleName
set to true
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>