Exemple #1
0
 void RegisterRegularType(Type t)
 {
     if (!_regularTypeCollector.ContainsKey(t))
     {
         var c = TypeAttributesCache.CreateOnRegularType(_monitor, _serviceProvider, t);
         _regularTypeCollector.Add(t, c);
         if (c != null)
         {
             _monitor.Trace($"At least one bound attribute on '{t}' has been registered.");
             RegisterAssembly(t);
         }
     }
 }
        internal AutoServiceInterfaceInfo(TypeAttributesCache type, CKTypeKind lt, IEnumerable <AutoServiceInterfaceInfo> baseInterfaces)
        {
            Debug.Assert(lt == CKTypeKind.IsAutoService ||
                         lt == (CKTypeKind.IsAutoService | CKTypeKind.IsSingleton) ||
                         lt == (CKTypeKind.IsAutoService | CKTypeKind.IsScoped));
            Attributes      = type;
            InitialTypeKind = lt;
            AutoServiceInterfaceInfo[] bases = Array.Empty <AutoServiceInterfaceInfo>();
            int depth = 0;

            foreach (var iT in baseInterfaces)
            {
                depth = Math.Max(depth, iT.SpecializationDepth + 1);
                Array.Resize(ref bases, bases.Length + 1);
                bases[bases.Length - 1] = iT;
                iT.IsSpecialized        = true;
            }
            SpecializationDepth = depth;
            Interfaces          = bases;
        }