コード例 #1
0
        /// <summary>
        /// Returns the <see cref="MappingCompiledInfo"/> using given destinationType and sourceType.
        /// </summary>
        /// <param name="destinationType"></param>
        /// <param name="sourceType"></param>
        /// <param name="mappingCompiledInfo"></param>
        /// <returns>A value indicating that value is found or not.</returns>
        public bool TryGetCompiledInfo(Type destinationType, Type sourceType,
                                       out MappingCompiledInfo mappingCompiledInfo)
        {
            var hash = Mapping.ComputeHash(destinationType, sourceType);

            Lock.EnterReadLock();

            try
            {
                return(CompiledCache.TryGetValue(hash, out mappingCompiledInfo));
            }
            finally
            {
                Lock.ExitReadLock();
            }
        }
コード例 #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();
            }
        }