private bool Equals(KeyAll other) { return(Byte == other.Byte && SByte == other.SByte && Short == other.Short && UShort == other.UShort && Int == other.Int && UInt == other.UInt && Long == other.Long && ULong == other.ULong && Float.Equals(other.Float) && Double.Equals(other.Double) && Decimal == other.Decimal && Guid.Equals(other.Guid) && string.Equals(String, other.String) && Key.Equals(other.Key)); }
public void TestCompositeKeyAllDataTypes() { var cfg = new CacheConfiguration("composite_key_all", new QueryEntity(typeof(KeyAll), typeof(string))); var cache = Ignition.GetIgnite().CreateCache <KeyAll, string>(cfg); var key = new KeyAll { Byte = byte.MaxValue, SByte = sbyte.MaxValue, Short = short.MaxValue, UShort = ushort.MaxValue, Int = int.MaxValue, UInt = uint.MaxValue, Long = long.MaxValue, ULong = ulong.MaxValue, Float = float.MaxValue, Double = double.MaxValue, Decimal = decimal.MaxValue, Guid = Guid.NewGuid(), String = "привет", Key = new Key(255, 65555) }; // Test insert. var res = cache.QueryFields(new SqlFieldsQuery( "insert into string(byte, sbyte, short, ushort, int, uint, long, ulong, float, double, decimal, " + "guid, string, key, _val) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", key.Byte, key.SByte, key.Short, key.UShort, key.Int, key.UInt, key.Long, key.ULong, key.Float, key.Double, key.Decimal, key.Guid, key.String, key.Key, "VALUE")) .GetAll(); Assert.AreEqual(1, res.Count); Assert.AreEqual(1, res[0].Count); Assert.AreEqual(1, res[0][0]); // Compare resulting keys. Assert.AreEqual(key, cache.Single().Key); // Compare keys in binary form. var binKey = cache.Ignite.GetBinary().ToBinary <BinaryObject>(key); var binKeyRes = cache.WithKeepBinary <BinaryObject, string>().Single().Key; Assert.AreEqual(binKey.Header, binKeyRes.Header); Assert.AreEqual(binKey, binKeyRes); // Get by key to verify identity. Assert.AreEqual("VALUE", cache[key]); }