Exemplo n.º 1
0
        /// <summary>
        /// Returns the <see cref="Mapping"/> using given destinationType and sourceType.
        /// </summary>
        /// <param name="destinationType"></param>
        /// <param name="sourceType"></param>
        /// <param name="mapping"></param>
        /// <returns>A value indicating that value is found or not.</returns>
        public bool TryGetMapping(Type destinationType, Type sourceType, out Mapping mapping)
        {
            var hash = Mapping.ComputeHash(destinationType, sourceType);

            Lock.EnterReadLock();

            try
            {
                return(MappingRows.TryGetValue(hash, out mapping));
            }
            finally
            {
                Lock.ExitReadLock();
            }
        }
Exemplo n.º 2
0
        public bool TryGetMappingAndCompiledInfo(Type destinationType, Type sourceType, out Mapping mapping,
                                                 out MappingCompiledInfo mappingCompiledInfo)
        {
            var hash = Mapping.ComputeHash(destinationType, sourceType);

            Lock.EnterReadLock();

            try
            {
                var result = MappingRows.TryGetValue(hash, out mapping);
                CompiledCache.TryGetValue(hash, out mappingCompiledInfo);
                return(result);
            }
            finally
            {
                Lock.ExitReadLock();
            }
        }