Пример #1
0
            private Type getTargetType(WorkContext work, string typeName)
            {
              const string PORTAL_PREFIX = @"!#PORTAL\";

              if (typeName.IsNullOrWhiteSpace()) return null;
              Type result = null;
              string key;

              if (work.Portal==null)
                key = typeName;
              else
                key = PORTAL_PREFIX+work.Portal.Name+typeName;


              //1 Lookup in cache
              if (m_Lookup.TryGetValue(key, out result)) return result;

              //2 Lookup in locations
              result = lookupTargetInLocations(work, typeName);
              if (result!=null)
              {
                var lookup = new TypeLookup(m_Lookup);//thread safe copy

                lookup[key] =  result;//other thread may have added already
                m_Lookup = lookup;//atomic
                return result;
              }

              return null;//404 error - type not found
            }
Пример #2
0
 public TypeLookup(TypeLookup clone) : base(clone, StringComparer.Ordinal)
 {
 }