Hi.


What is a right way to add TestEntity(it has 2 fields) into the cache via
REST API.



This is how I created TestEntity cache:



public class TestEntity

    {

        public string ValueString { get; set; }



        public DateTime ValueDateTime { get; set; }

    }



    class Program

    {

        static void Main(string[] args)

        {

            var ignite = Ignition.StartClient(newIgniteClientConfiguration

            {

                Host = "127.0.0.1"

                ,

                BinaryConfiguration = newApache.Ignite.Core.Binary.
BinaryConfiguration { Serializer = new Apache.Ignite.Core.Binary.
BinaryReflectiveSerializer { ForceTimestamp = true } }

            });



            var queryEntity = new QueryEntity();

            queryEntity.KeyTypeName =typeof(int).FullName;

            queryEntity.KeyType = typeof(int);



            queryEntity.ValueTypeName =typeof(TestEntity).FullName;

            queryEntity.ValueType = typeof(TestEntity);



            queryEntity.Fields = new QueryField[]

            { new QueryField("ValueString", typeof(string))

            , new QueryField("ValueDateTime",typeof(DateTime))

            };



            var cache = ignite.GetOrCreateCache<int,TestEntity>(

                                           newCacheClientConfiguration(
"TestEntity", queryEntity) { SqlSchema = "PUBLIC" });





            //cache.Put(1, new TestEntity { ValueString = "test",
ValueDateTime = DateTime.UtcNow });



            ignite.Dispose();

        }

    }

Reply via email to