示例#1
0
        public IServiceProvider CreateServiceProvider(ContainerBuilder containerBuilder)
        {
            var container     = containerBuilder.Build();
            var configuration = container.Resolve <IConfiguration>();

            var watchman = new WatchmanBot(new DiscordConfiguration
            {
                MongoDbConnectionString = configuration.GetConnectionString("Mongo"),
                Token = configuration["Discord:Token"]
            }, container.Resolve <IComponentContext>()).GetWorkflowBuilder();

            return(new AutofacServiceProvider(container));
        }
        public IServiceProvider CreateServiceProvider(ContainerBuilder containerBuilder)
        {
            var container = containerBuilder.Build();

            var workflowBuilder = new WatchmanBot(new DiscordConfiguration
            {
                MongoDbConnectionString = this._configuration.GetConnectionString("Mongo"),
                Token = this._configuration["Discord:Token"]
            }, container.Resolve <IComponentContext>()).GetWorkflowBuilder();

            workflowBuilder.Build();
            container.Resolve <HangfireJobsService>().SetDefaultJobs(container);
            return(new AutofacServiceProvider(container));
        }