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); }
public ChannelProxyFactory() { cacheItem = ChannelProxyCache.Current.GetOrAdd <TChannel, TProxy>(); }