public void Service_Created_With_Abp_IocManager()
        {
            using (var bootstrapper = new AbpBootstrapper())
            {
                bootstrapper.Initialize();

                bool hasStarted = false;

                var host = HostFactory.New(cfg =>
                                           {
                                               cfg.UseTestHost();
                                               cfg.UseAbp(bootstrapper);
                                               cfg.Service<TestService>(svc =>
                                                                        {
                                                                            svc.ConstructUsingAbp();
                                                                            svc.WhenStarted(s => hasStarted = s.Start());
                                                                            svc.WhenStopped(s => s.Stop());
                                                                        });
                                           });

                var exitCode = host.Run();
                Assert.AreEqual(TopshelfExitCode.Ok, exitCode);
                Assert.IsTrue(hasStarted);
            }
        }
        public static HostConfigurator UseAbp(this HostConfigurator configurator, AbpBootstrapper abpBootstrapper)
        {
            var log = HostLogger.Get(typeof(HostConfiguratorExtensions));

            log.Info("[Topshelf.Abp] Integration Started in host.");

            configurator.AddConfigurator(new AbpBuilderConfigurator(abpBootstrapper));
            return configurator;
        }
        static void Main(string[] args)
        {
            using (var bootstrapper = new AbpBootstrapper())
            {
                bootstrapper.Initialize();

                Test_Way_1(bootstrapper.IocManager);
                Test_Way_2(bootstrapper.IocManager);
                Test_Way_3(bootstrapper.IocManager);
            }

            Console.ReadLine();
        }
        static void Main()
        {
            using (var bootstrapper = new AbpBootstrapper())
            {
                bootstrapper.IocManager.IocContainer.AddFacility<LoggingFacility>(f => f.UseLog4Net().WithConfig("log4net.config"));
                
                bootstrapper.Initialize();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(bootstrapper.IocManager.Resolve<MainForm>());
            }
        }
        static int Main(string[] args)
        {
            using (var bootstrapper = new AbpBootstrapper())
            {
                bootstrapper.Initialize();

                return (int)HostFactory.Run(x =>
                {
                    x.SetServiceName("Topshelf.Abp.SampleService");
                    x.SetDescription("Topshelf.Abp Sample Service");
                    x.UseAbp(bootstrapper);
                    x.Service<SampleService>(svc =>
                                             {
                                                 svc.ConstructUsingAbp();
                                                 svc.WhenStarted(s => s.Start());
                                                 svc.WhenStopped(s => s.Stop());
                                             });
                });
            }
        }
Beispiel #6
0
        public static void Main(string[] args)
        {
            ParseArgs(args);

            using (var bootstrapper = new AbpBootstrapper())
            {
                bootstrapper.IocManager.IocContainer
                    .AddFacility<LoggingFacility>(f => f.UseLog4Net()
                        .WithConfig("log4net.config")
                    );

                bootstrapper.Initialize();

                using (var migrateExecuter = bootstrapper.IocManager.ResolveAsDisposable<MultiTenantMigrateExecuter>())
                {
                    migrateExecuter.Object.Run(_skipConnVerification);
                }

                Console.WriteLine("Press ENTER to exit...");
                Console.ReadLine();
            }
        }
        static int Main(string[] args)
        {
            using (var bootstrapper = new AbpBootstrapper())
            {
                bootstrapper.Initialize();

                return (int)HostFactory.Run(x =>
                                            {
                                                x.SetServiceName("Topshelf.Quartz.Abp.SampleService");
                                                x.SetDescription("Topshelf.Quartz.Abp Sample Service");
                                                x.UseQuartzAbp(bootstrapper);
                                                x.ScheduleQuartzJobAsService(q =>
                                                              q.WithJob(() => JobBuilder.Create<SampleJob>().Build())
                                                              .AddTrigger(() => TriggerBuilder.Create()
                                                                                .WithSimpleSchedule(builder => builder
                                                                                       .WithIntervalInSeconds(30)
                                                                                       .RepeatForever())
                                                                                 .Build())
                                                 );
                                            });
            }
        }
        public void Quartz_Job_Created_With_Abp_IocManager()
        {
            using (var bootstrapper = new AbpBootstrapper())
            {
                bootstrapper.Initialize();

                bool hasStarted = false;

                var host = HostFactory.New(cfg =>
                                           {
                                               cfg.UseTestHost();
                                               cfg.UseQuartzAbp(bootstrapper);
                                               cfg.ScheduleQuartzJobAsService(q => q.WithJob(() => JobBuilder.Create<TestJob>().Build())
                                                   .AddTrigger(() => TriggerBuilder.Create()
                                                       .WithSimpleSchedule(builder => builder.WithRepeatCount(0).Build()).Build()));
                                           });

                var exitCode = host.Run();
                Thread.Sleep(TimeSpan.FromSeconds(2.0));
                Assert.AreEqual(TopshelfExitCode.Ok, exitCode);
                Assert.IsTrue(TestJob.Executed);
            }
        }
 public App()
 {
     IocManager.Instance.IocContainer.AddFacility<LoggingFacility>(f => f.UseLog4Net().WithConfig("log4net.config"));
     _bootstrapper = new AbpBootstrapper();
 }
 public AbpBuilderConfigurator(AbpBootstrapper abpBootstrapper)
 {
     _abpBootstrapper = abpBootstrapper;
 }
 public static HostConfigurator UseQuartzAbp(this HostConfigurator configurator, AbpBootstrapper abpBootstrapper)
 {
     configurator.UseAbp(abpBootstrapper);
     AbpScheduleJobServiceConfiguratorExtensions.SetupAbp();
     return configurator;
 }