Beispiel #1
0
 /// <summary>
 /// Collects the one-time global registration data from the attribute installers, one that is not per-attribute or per-assembly.
 /// Invoked from <see cref="InvokeAttributeInstallersInstance"/>, don't call manually.
 /// </summary>
 protected void InvokeAttributeInstallersStatic(InstallationDataXml total)
 {
     foreach (IInstallAttributes installer in MapInstallerTypeToInstance.Values)
     {
         InstallationDataXml data = installer.InstallStatic(this);
         if (data != null)
         {
             total.MergeWith(data);
         }
     }
 }
Beispiel #2
0
 protected InstallationDataXml InvokeAttributeInstallersInstance(InstallationDataXml retval)
 {
     // Process each known assembly
     foreach (Assembly assembly in Assemblies)
     {
         // Invoke registration
         try
         {
             foreach (var pair in MapAttributeToInstallers)
             {
                 foreach (object attribute in assembly.GetCustomAttributes(pair.Key, false))
                 {
                     foreach (IInstallAttributes installer in pair.Value)
                     {
                         try
                         {
                             // Collect installation data!
                             InstallationDataXml data = installer.InstallInstance(this, attribute);
                             if (data != null)
                             {
                                 retval.MergeWith(data);
                             }
                         }
                         catch (Exception ex)
                         {
                             throw new InvalidOperationException(string.Format("Failed to collect the installation data for the attribute of type “{0}” from the assembly “{1}” using the “{2}” installer. {3}", pair.Key.AssemblyQualifiedName, assembly.FullName, installer.GetType().AssemblyQualifiedName, ex.Message), ex);
                         }
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             throw new InvalidOperationException(string.Format("Failed to process the “{0}” assembly. {1}", assembly.FullName, ex.Message), ex);
         }
     }
     return(retval);
 }