示例#1
0
        public ChannelProxyCacheItem <TChannel, TProxy> GetOrAdd <TChannel, TProxy>()
            where TChannel : class
            where TProxy : ChannelProxy <TChannel>
        {
            ChannelProxyCacheItem <TChannel, TProxy> item;

            lock (itemsLocker) {
                item = items.OfType <ChannelProxyCacheItem <TChannel, TProxy> >().FirstOrDefault();
                if (item == null)
                {
                    item = new ChannelProxyCacheItem <TChannel, TProxy>(assemblyBuilderFactory);
                    items.Add(item);
                }
            }

            return(item);
        }
示例#2
0
 public ChannelProxyFactory()
 {
     cacheItem = ChannelProxyCache.Current.GetOrAdd <TChannel, TProxy>();
 }