Пример #1
0
 private static void Initialize(Assembly assembly)
 {
     lock (Instrumentation.instrumentedAssemblies)
     {
         if (!Instrumentation.instrumentedAssemblies.ContainsKey(assembly))
         {
             SchemaNaming schemaNaming = SchemaNaming.GetSchemaNaming(assembly);
             if (schemaNaming != null)
             {
                 if (!schemaNaming.IsAssemblyRegistered())
                 {
                     if (WMICapabilities.IsUserAdmin())
                     {
                         schemaNaming.DecoupledProviderInstanceName = AssemblyNameUtility.UniqueToAssemblyFullVersion(assembly);
                         schemaNaming.RegisterNonAssemblySpecificSchema(null);
                         schemaNaming.RegisterAssemblySpecificSchema();
                     }
                     else
                     {
                         throw new Exception(RC.GetString("ASSEMBLY_NOT_REGISTERED"));
                     }
                 }
                 InstrumentedAssembly instrumentedAssembly = new InstrumentedAssembly(assembly, schemaNaming);
                 Instrumentation.instrumentedAssemblies.Add(assembly, instrumentedAssembly);
             }
         }
     }
 }
Пример #2
0
        private static void Initialize(Assembly assembly)
        {
            lock (instrumentedAssemblies)
            {
                if (instrumentedAssemblies.ContainsKey(assembly))
                {
                    return;
                }

                SchemaNaming naming = SchemaNaming.GetSchemaNaming(assembly);
                if (naming == null)
                {
                    return;
                }

                if (false == naming.IsAssemblyRegistered())
                {
                    // If we are not an administrator, don't try to JIT install the schema
                    if (!WMICapabilities.IsUserAdmin())
                    {
                        throw new Exception(RC.GetString("ASSEMBLY_NOT_REGISTERED"));
                    }

                    naming.RegisterNonAssemblySpecificSchema(null);
                    naming.RegisterAssemblySpecificSchema();
                }

                InstrumentedAssembly instrumentedAssembly = new InstrumentedAssembly(assembly, naming);
                instrumentedAssemblies.Add(assembly, instrumentedAssembly);
            }
        }
Пример #3
0
        private static void Initialize(Assembly assembly)
        {
            lock (instrumentedAssemblies)
            {
                if (instrumentedAssemblies.ContainsKey(assembly))
                {
                    return;
                }

                SchemaNaming naming = SchemaNaming.GetSchemaNaming(assembly);
                if (naming == null)
                {
                    return;
                }

                if (false == naming.IsAssemblyRegistered())
                {
                    // If we are not an administrator, don't try to JIT install the schema
                    if (!WMICapabilities.IsUserAdmin())
                    {
                        throw new Exception(RC.GetString("ASSEMBLY_NOT_REGISTERED"));
                    }

                    //
                    // We always use the full version number for Whidbey.
                    //
                    naming.DecoupledProviderInstanceName = AssemblyNameUtility.UniqueToAssemblyFullVersion(assembly);

                    naming.RegisterNonAssemblySpecificSchema(null);
                    naming.RegisterAssemblySpecificSchema();
                }

                InstrumentedAssembly instrumentedAssembly = new InstrumentedAssembly(assembly, naming);
                instrumentedAssemblies.Add(assembly, instrumentedAssembly);
            }
        }