Exemplo n.º 1
0
        public static Type GetWrapper(Type interfaceType, Type realObjectType)
        {
            Type wrapperType = _wrapperDictionary.GetType(interfaceType, realObjectType);

            if (wrapperType == null)
            {
                wrapperType = GenerateWrapperType(interfaceType, realObjectType);
                _wrapperDictionary.SetType(interfaceType, realObjectType, wrapperType);
            }

            return(wrapperType);
        }
Exemplo n.º 2
0
        public static Type GetWrapper(Type interfaceType, Type realObjectType)
        {
            Type type = _wrapperDictionary.GetType(interfaceType, realObjectType);

            if (type == null)
            {
                lock (_lock)
                {
                    type = _wrapperDictionary.GetType(interfaceType, realObjectType);
                    if (type == null)
                    {
                        type = GenerateWrapperType(interfaceType, realObjectType);
                        _wrapperDictionary.SetType(interfaceType, realObjectType, type);
                    }
                }
            }
            return(type);
        }