Пример #1
0
        public static int LoadInstallers(this IWindsorContainer container)
        {
            WindsorConfigManager config = new WindsorConfigManager(new ConfigManager());
            Assembly[] installerAssemblies = default(Assembly[]);
            IWindsorInstaller[] installers = default(IWindsorInstaller[]);
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                installerAssemblies = config.GetInstallerAssemblies();
                //installers
            });
            if (installerAssemblies.Length > 0)
            {
                foreach (Assembly assembly in installerAssemblies)
                {
                    container.Install(Castle.Windsor.Installer.FromAssembly.Instance(assembly));
                }
            }

            return installerAssemblies.Length;
        }
        // Uncomment the method below to handle the event raised before a feature is deactivated.

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            WindsorConfigManager config = new WindsorConfigManager(new ConfigManager());
            config.RemoveInstallerAssembly(Assembly.GetExecutingAssembly());
        }