DiscoverAndLoadPackages() public method

public DiscoverAndLoadPackages ( System.Action onAssembliesScanned, bool runActivators = true ) : void
onAssembliesScanned System.Action
runActivators bool
return void
コード例 #1
0
        public static void LoadPackages(Action <IPackageFacility> configuration, bool runActivators = true)
        {
            _packages.Clear();

            Diagnostics = new PackagingDiagnostics();
            var record = new PackageLoadingRecord();

            Diagnostics.LogExecution(record, () =>
            {
                var facility       = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph          = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = findCallToLoadPackages();
                graph.PushProvenance(codeLocation);
                configuration(facility);
                facility.Configure(graph);


                graph.PopProvenance();
                graph.DiscoverAndLoadPackages(() =>
                {
                    _assemblies.Clear();
                    _assemblies.AddRange(assemblyLoader.Assemblies);
                }, runActivators);
            });

            record.Finished = DateTime.Now;

            //_packages.Clear();
        }
コード例 #2
0
        public static void LoadPackages(Action<IPackageFacility> configuration, bool runActivators = true)
        {
            _packages.Clear();

            Diagnostics = new PackagingDiagnostics();
            var record = new PackageLoadingRecord();

            Diagnostics.LogExecution(record, () =>
            {
                var facility = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = findCallToLoadPackages();
                graph.PushProvenance(codeLocation);
                configuration(facility);
                facility.Configure(graph);


                graph.PopProvenance();
                graph.DiscoverAndLoadPackages(() =>
                {
                    _assemblies.Clear();
                    _assemblies.AddRange(assemblyLoader.Assemblies);
                }, runActivators);
            });

            record.Finished = DateTime.Now;

            //_packages.Clear();


        }
コード例 #3
0
        /// <summary>
        /// The entry method into the bottles environment
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="runActivators"></param>
        public static void LoadPackages(Action <IPackageFacility> configuration, bool runActivators = true)
        //consider renaming to InitializeEnvironment
        //have it return an environment object.
        {
            _packages.Clear();
            _remotes.Clear();

            Diagnostics = new BottlingDiagnostics(new LoggingSession());
            var record = new BottleLoadingRecord();

            Diagnostics.LogExecution(record, () => {
                var remotes = RemoteService.LoadLinkedRemotes();
                _remotes.AddRange(remotes);
                var remoteTasks = remotes.Select(x => x.Start()).ToArray();

                var facility       = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph          = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = ProvenanceHelper.GetProvenanceFromStack();
                graph.InProvenance(codeLocation, g =>
                {
                    //collect user configuration
                    configuration(facility);

                    //applies collected configurations
                    facility.Configure(g);
                });


                graph.DiscoverAndLoadPackages(() =>
                {
                    //clearing assemblies why? - my guess is testing.
                    // this should only really be called once.
                    _assemblies.Clear();

                    _assemblies.AddRange(assemblyLoader.Assemblies);
                    //the above assemblies are used when we need to resolve bottle assemblies
                }, runActivators);

                Task.WaitAll(remoteTasks);
            });

            record.Finished = DateTime.Now;
        }
コード例 #4
0
        /// <summary>
        /// The entry method into the bottles environment
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="runActivators"></param>
        public static void LoadPackages(Action <IPackageFacility> configuration, bool runActivators = true)
        //consider renaming to InitializeEnvironment
        //have it return an environment object.
        {
            _packages.Clear();

            Diagnostics = new PackagingDiagnostics();
            var record = new PackageLoadingRecord();

            Diagnostics.LogExecution(record, () =>
            {
                var facility       = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph          = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = findCallToLoadPackages();
                graph.InProvenance(codeLocation, g =>
                {
                    //collect user configuration
                    configuration(facility);

                    //applies collected configurations
                    facility.Configure(g);
                });


                graph.DiscoverAndLoadPackages(() =>
                {
                    //clearing assemblies why? - my guess is testing.
                    // this should only really be called once.
                    _assemblies.Clear();

                    _assemblies.AddRange(assemblyLoader.Assemblies);
                    //the above assemblies are used when we need to resolve bottle assemblies
                }, runActivators);
            });

            record.Finished = DateTime.Now;
        }
コード例 #5
0
        public static void LoadPackages(Action <IPackageFacility> configuration)
        {
            _packages.Clear();

            var facility = new PackageFacility();

            Diagnostics = new PackagingDiagnostics();
            var assemblyLoader = new AssemblyLoader(Diagnostics);
            var graph          = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

            var codeLocation = findCallToLoadPackages();

            graph.PushProvenance(codeLocation);
            configuration(facility);
            facility.As <IPackagingRuntimeGraphConfigurer>().Configure(graph);

            graph.PopProvenance();
            graph.DiscoverAndLoadPackages(() =>
            {
                _assemblies.Clear();
                _assemblies.AddRange(assemblyLoader.Assemblies);
            });
        }
コード例 #6
0
ファイル: PackageRegistry.cs プロジェクト: cprieto/fubumvc
        public static void LoadPackages(Action<IPackageFacility> configuration)
        {
            _packages.Clear();

            var facility = new PackageFacility();
            Diagnostics = new PackagingDiagnostics();
            var assemblyLoader = new AssemblyLoader(Diagnostics);
            var graph = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

            var codeLocation = findCallToLoadPackages();
            graph.PushProvenance(codeLocation);
            configuration(facility);
            facility.As<IPackagingRuntimeGraphConfigurer>().Configure(graph);

            graph.PopProvenance();
            graph.DiscoverAndLoadPackages(() =>
                                          	{
                                          		_assemblies.Clear();
                                          		_assemblies.AddRange(assemblyLoader.Assemblies);
                                          	});
        }
コード例 #7
0
ファイル: PackageRegistry.cs プロジェクト: wbinford/bottles
        //consider renaming to InitializeEnvironment
        //have it return an environment object.
        /// <summary>
        /// The entry method into the bottles environment
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="runActivators"></param>
        public static void LoadPackages(Action<IPackageFacility> configuration, bool runActivators = true)
        {
            _packages.Clear();

            Diagnostics = new BottlingDiagnostics(new LoggingSession());
            var record = new BottleLoadingRecord();

            Diagnostics.LogExecution(record, () =>
            {
                var facility = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = ProvenanceHelper.GetProvenanceFromStack();
                graph.InProvenance(codeLocation, g =>
                {
                    //collect user configuration
                    configuration(facility);

                    //applies collected configurations
                    facility.Configure(g);
                });

                graph.DiscoverAndLoadPackages(() =>
                {
                    //clearing assemblies why? - my guess is testing.
                    // this should only really be called once.
                    _assemblies.Clear();

                    _assemblies.AddRange(assemblyLoader.Assemblies);
                    //the above assemblies are used when we need to resolve bottle assemblies
                }, runActivators);
            });

            record.Finished = DateTime.Now;
        }
コード例 #8
0
        /// <summary>
        /// The entry method into the bottles environment
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="runActivators"></param>
        public static void LoadPackages(Action<IPackageFacility> configuration, bool runActivators = true)
            //consider renaming to InitializeEnvironment
            //have it return an environment object.
        {
            _packages.Clear();

            Diagnostics = new PackagingDiagnostics();
            var record = new PackageLoadingRecord();

            Diagnostics.LogExecution(record, () =>
            {
                var facility = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = findCallToLoadPackages();
                graph.InProvenance(codeLocation, g =>
                {
                    //collect user configuration
                    configuration(facility);

                    //applies collected configurations
                    facility.Configure(g);
                });


                graph.DiscoverAndLoadPackages(() =>
                {
                    //clearing assemblies why? - my guess is testing.
                    // this should only really be called once.
                    _assemblies.Clear();

                    _assemblies.AddRange(assemblyLoader.Assemblies);
                    //the above assemblies are used when we need to resolve bottle assemblies
                }, runActivators);
            });

            record.Finished = DateTime.Now;
        }