Пример #1
0
        /// <summary>
        /// For revocation and configuration
        /// </summary>
        /// <param name="main"></param>
        /// <param name="runLevel"></param>
        /// <returns></returns>
        public ILifetimeScope Configuration(ILifetimeScope main, Renewal renewal, RunLevel runLevel)
        {
            IResolver resolver = null;

            if (runLevel.HasFlag(RunLevel.Interactive))
            {
                resolver = main.Resolve <InteractiveResolver>(new TypedParameter(typeof(RunLevel), runLevel));
            }
            else
            {
                resolver = main.Resolve <UnattendedResolver>();
            }
            return(main.BeginLifetimeScope(builder =>
            {
                builder.Register(c => runLevel).As <RunLevel>();
                builder.Register(c => resolver).As <IResolver>();
                builder.Register(c => resolver.GetTargetPlugin(main).Result).As <ITargetPluginOptionsFactory>().SingleInstance();
                builder.Register(c => resolver.GetCsrPlugin(main).Result).As <ICsrPluginOptionsFactory>().SingleInstance();
            }));
        }