Exemple #1
0
 private void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
 {
     if (sender == ownAppDomain)
     {
         try
         {
             if (!args.LoadedAssembly.ReflectionOnly)
             {
                 if (OnDIContainerAssemblyLoadedHook(args.LoadedAssembly))
                 {
                     if (assemblySelector(args.LoadedAssembly))
                     {
                         IList <Type> typesFound = AppDomainHelper.GetTypesMarkedWithAttribute(args.LoadedAssembly, typeof(DIContainerAutoRegisterableTypeAttribute), (a, t) => true);
                         AutoRegisterTypesInternal(typesWithCustomRegistrationFuncEnabled, typesFound);
                     }
                 }
                 else
                 {
                     System.Diagnostics.Debug.WriteLine("DIContainerAssemblyLoadedHook disallowed autoregistration of types in assembly: ", args.LoadedAssembly.ToString());
                 }
             }
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine("Cannot auto register types in assembly {0}: {1}", args.LoadedAssembly.FullName, ex); //LOCSTR
         }
     }
 }
Exemple #2
0
        public virtual void AutoRegisterTypes(bool typesWithCustomRegistrationFuncToo)
        {
            IList <Type> typesFound = AppDomainHelper.GetTypesMarkedWithAttribute(typeof(DIContainerAutoRegisterableTypeAttribute), assemblySelector, (a, t) => true);

            AutoRegisterTypesInternal(typesWithCustomRegistrationFuncToo, typesFound);
        }