Example #1
0
 private (IBinaryObject, Dictionary <string, (string, string?, object?)[]>) CreateDelegateParameters(object parameters)
 {
     var binary           = _igniteClient.GetBinary();
     var builder          = binary.GetBuilder($"stream{Guid.NewGuid():N}");
     var streamParameters = new Dictionary <string, (string, string?, object?)[]>();
Example #2
0
        public static void Main()
        {
            using (IIgniteClient ignite = Ignition.StartClient(Utils.GetThinClientConfiguration()))
            {
                Console.WriteLine();
                Console.WriteLine(">>> Binary mode example started.");

                // Create new cache and configure queries for Person and Company binary types.
                // Note that there are no such classes defined.
                var cache0 = ignite.GetOrCreateCache <object, object>(new CacheClientConfiguration
                {
                    Name          = CacheName,
                    QueryEntities = new[]
                    {
                        new QueryEntity
                        {
                            KeyType       = typeof(int),
                            ValueTypeName = PersonType,
                            Fields        = new[]
                            {
                                new QueryField(NameField, typeof(string)),
                                new QueryField(CompanyIdField, typeof(int)),
                            },
                            Indexes = new[]
                            {
                                new QueryIndex(false, QueryIndexType.FullText, NameField),
                                new QueryIndex(false, QueryIndexType.Sorted, CompanyIdField)
                            }
                        },
                        new QueryEntity
                        {
                            KeyType       = typeof(int),
                            ValueTypeName = CompanyType,
                            Fields        = new[]
                            {
                                new QueryField(IdField, typeof(int)),
                                new QueryField(NameField, typeof(string))
                            }
                        }
                    }
                });

                // Switch to binary mode to work with data in serialized form.
                var cache = cache0.WithKeepBinary <int, IBinaryObject>();

                // Clean up caches on all nodes before run.
                cache.Clear();

                // Populate cache with sample data entries.
                PopulateCache(cache, ignite.GetBinary());

                // Run read & modify example.
                ReadModifyExample(cache);

                // Run SQL query example.
                SqlQueryExample(cache);

                // Run SQL query with join example.
                SqlJoinQueryExample(cache);

                Console.WriteLine();
            }

            Console.WriteLine();
            Console.WriteLine(">>> Example finished, press any key to exit ...");
            Console.ReadKey();
        }
        /// <summary>
        /// Checks the actual compact footer behavior.
        /// </summary>
        private static void AssertCompactFooter(IIgniteClient client, bool expected)
        {
            var binObj = (BinaryObject)client.GetBinary().GetBuilder("foo").Build();

            Assert.AreEqual(expected, binObj.Header.Flags.HasFlag(BinaryObjectHeader.Flag.CompactFooter));
        }