Пример #1
0
        /// <summary>
        /// Removes a mapping (and it's compiled cache) from <see cref="MapperContext"/>.
        /// </summary>
        /// <param name="destinationType"></param>
        /// <param name="sourceType"></param>
        /// <returns></returns>
        public bool Remove(Type destinationType, Type sourceType)
        {
            var hash = Mapping.ComputeHash(destinationType, sourceType);

            Lock.EnterWriteLock();

            try
            {
                var result = MappingRows.Remove(hash);
                CompiledCache.Miss(hash);
                return(result);
            }
            finally
            {
                Lock.ExitWriteLock();
            }
        }
Пример #2
0
        /// <summary>
        /// Removes a mapping (and it's compiled cache) from <see cref="MapperContext"/>.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool Remove(Mapping item)
        {
            var hash = Mapping.ComputeHash(item);

            Lock.EnterWriteLock();

            try
            {
                var result = MappingRows.Remove(hash);
                CompiledCache.Miss(hash);
                return(result);
            }
            finally
            {
                Lock.ExitWriteLock();
            }
        }