Пример #1
0
        private void LoadAssemblies(string[] filenames)
        {
            foreach (var filename in filenames)
            {
                string             completePath = Path.Combine(Utils.ExtensionsDirectory, filename);
                Assembly           assem        = Assembly.LoadFrom(completePath);
                Type[]             types        = assem.GetExportedTypes();
                IMVSynchronization provisionDll = null;

                foreach (Type type in types)
                {
                    if (type.GetInterface("Microsoft.MetadirectoryServices.IMVSynchronization") != null)
                    {
                        provisionDll = (IMVSynchronization)assem.CreateInstance(type.FullName);
                    }
                }

                // If an object type starting with "MVExtension" could not be found,
                // or if an instance could not be created, throw an exception.
                if (provisionDll == null)
                {
                    throw new Exception("Unable to load file " + completePath + " as an provisioning assembly (IMVSynchronization)");
                }

                _loadedDlls.Add(provisionDll);

                // Call the Initialize() method on each MV extension object.
                provisionDll.Initialize();
            }
        }
Пример #2
0
 public void Initialize()
 {
     Tracer.TraceInformation("invoke-initialize: reference-id: {0}, filename: {1}", ReferenceId, FilenameFull);
     instance.Initialize();
 }