/// <summary> /// Adds a mapping to <see cref="MapperContext"/>. /// </summary> /// <param name="item"></param> public void Add(Mapping item) { var hash = Mapping.ComputeHash(item); Lock.EnterWriteLock(); try { MappingRows.Add(hash, item); CompiledCache.Miss(hash); } finally { Lock.ExitWriteLock(); } }
/// <summary> /// Adds a range of mappings to <see cref="MapperContext"/>. /// </summary> /// <param name="items"></param> public void AddRange(IEnumerable <Mapping> items) { var hashes = new List <int>(); Lock.EnterWriteLock(); try { foreach (var item in items) { var hash = Mapping.ComputeHash(item); MappingRows.Add(hash, item); hashes.Add(hash); } CompiledCache.MissAll(hashes); } finally { Lock.ExitWriteLock(); } }