Example #1
0
        protected override void BeginProcessing()
        {
            _moduleLoader = new ModuleLoader(ExecutionContext);
            // evaluate meaning of scope parameters:
            // -Global or -Scope global: Import module and items to global session state
            // no options: import module to current modules session state table, import items to module scope
            // -scope local: import module to current modules session state table, import items to *local scope*
            if (Global.IsPresent && !String.IsNullOrEmpty(Scope))
            {
                throw new MethodInvocationException("You cannot specify both the Global and the Scope parameter!");
            }

            _loadToGlobalScope = Global.IsPresent || String.Equals(Scope, "Global", StringComparison.InvariantCultureIgnoreCase);
            _importScope = _loadToGlobalScope ? ModuleIntrinsics.ModuleImportScopes.Global
                                              : ModuleIntrinsics.ModuleImportScopes.Module;
            _importScope = String.Equals(Scope, "Local", StringComparison.InvariantCultureIgnoreCase) ? 
                                ModuleIntrinsics.ModuleImportScopes.Local : _importScope;

        }
Example #2
0
 void AddInitialSessionModules()
 {
     var moduleLoader = new ModuleLoader(ExecutionContext);
     foreach (var mod in _initialSessionState.Modules)
     {
         // Is it correct that ModuleSpecification.Name can be a path? Well, we use it like this for now.
         moduleLoader.LoadModuleByName(mod.Name, true);
     }
 }