/// <summary> /// Initializes a new instance of the <see cref="CacheConfiguration"/> class, /// performing a deep copy of specified cache configuration. /// </summary> /// <param name="other">The other configuration to perfrom deep copy from.</param> public CacheClientConfiguration(CacheClientConfiguration other) { if (other != null) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) { ClientCacheConfigurationSerializer.Write(stream, other, ClientSocket.CurrentProtocolVersion, true); stream.SynchronizeOutput(); stream.Seek(0, SeekOrigin.Begin); ClientCacheConfigurationSerializer.Read(stream, this, ClientSocket.CurrentProtocolVersion); } CopyLocalProperties(other); } }
/// <summary> /// Copies the local properties (properties that are not written in Write method). /// </summary> private void CopyLocalProperties(CacheClientConfiguration cfg) { Debug.Assert(cfg != null); if (QueryEntities != null && cfg.QueryEntities != null) { var entities = cfg.QueryEntities.Where(x => x != null).ToDictionary(x => GetQueryEntityKey(x), x => x); foreach (var entity in QueryEntities.Where(x => x != null)) { QueryEntity src; if (entities.TryGetValue(GetQueryEntityKey(entity), out src)) { entity.CopyLocalProperties(src); } } } }