Esempio n. 1
0
        public Startup(IHostingEnvironment env)
        {
            _billRepository            = new BillRepository();
            _shoppingRepository        = new ShoppingRepository();
            _peopleRepository          = new PeopleRepository();
            _toDoRepository            = new ToDoRepository();
            _householdRepository       = new HouseholdRepository();
            _discordService            = new DiscordService(new HttpClient());
            _userService               = new UserService(new UserCache(), _peopleRepository);
            _inviteLinkService         = new InviteLinkService();
            _googleTokenAuthentication = new GoogleTokenAuthentication(new HttpClient());
            _recurringBillWorker       = new RecurringBillWorker(_billRepository);

            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddEnvironmentVariables();

            if (env.IsDevelopment())
            {
                builder.AddApplicationInsightsSettings(developerMode: true);
            }

            var discordWorker           = new DiscordMessageListener(_billRepository, _shoppingRepository, _peopleRepository, _discordService);
            var backgroundDiscordWorker = new Task(() => discordWorker.StartWorker());

            backgroundDiscordWorker.Start();

            Configuration = builder.Build();
        }
Esempio n. 2
0
 public BillController(IBillRepository billRepository, IDiscordService discordService, IUserService userService, IRecurringBillWorker recurringBillWorker)
 {
     _userService         = userService;
     _billRepository      = billRepository;
     _discordService      = discordService;
     _recurringBillWorker = recurringBillWorker;
 }