protected override void Install(IInstallContext context)
        {
            if (this.App != context.App)
            {
                throw new InvalidOperationException($"this.{nameof(App)} should be the same as {nameof(context)}.{nameof(context.App)}.");
            }

            this.IsInstalled = true;
        }
예제 #2
0
        /// <summary>
        /// Installs all module dependencies of the current module recursively to the <see cref="AppConfig"/>.
        /// </summary>
        /// <param name="context">The install context.</param>
        protected override void Install(IInstallContext context)
        {
            var config    = this.App.GetConfig <AppConfig>();
            var installed = new HashSet <string>(config.Modules.Select(x => x.Type));
            var modules   = this.GetAllDependencies()
                            .Where(x => !installed.Contains(x.GetAssemblyQualifiedName()))
                            .OrderBy(x => x.Namespace)
                            .ThenBy(x => x.Name)
                            .Select(ModuleConfigElement.Create);

            foreach (var module in modules)
            {
                config.Modules.Add(module);
                context.RequestedAction = RequestedAction.Restart;
            }
        }
예제 #3
0
 /// <summary>
 /// Installs the module by making any permanent changes required for it to be initialized in the future.
 /// Automatically called by <see cref="ModuleBase.Install"/>
 /// There is no need to call the base method when overriding.
 /// </summary>
 /// <param name="context">The install context.</param>
 protected virtual void Install(IInstallContext context)
 {
 }
예제 #4
0
 void IInstallable.Install(IInstallContext context)
 {
     this.App = context.App;
     this.Install(context);
     this.App = null;
 }
 public void Install(IInstallContext context)
 {
     this.InitializeAppConfig(context.App.ConfigService);
     this.InitializeLoggingConfig(context.App.ConfigService);
     context.RequestedAction = RequestedAction.Restart;
 }
 public void Install(IInstallContext context)
 {
     this.IsInstalled = true;
 }
 public void Install(IInstallContext context)
 {
     this.InitializeAppConfig(context.App.ConfigManager);
     context.RequestedAction = RequestedAction.Restart;
 }
예제 #8
0
 /// <summary>
 /// Default implementation does nothing. Reimplement <see cref="IInstallable"/> to override.
 /// </summary>
 /// <param name="context">The install context.</param>
 void IInstallable.Install(IInstallContext context)
 {
 }
 public void Install(IInstallContext context)
 {
     this.IsInstalled = true;
 }
예제 #10
0
 protected override void Install(IInstallContext context)
 {
     base.Install(context);
     this.App.GetConfig <LoggingConfig>().Async = false;
     context.RequestedAction = RequestedAction.Restart;
 }