Example #1
0
        public static void RegisterDependencies(this IServiceCollection services, string connectionString)
        {
            services.AddDbContext <KinoheldDbContext>(p => p.UseMySql(connectionString));
            services.AddTransient <IAlexaHandler, AlexaHandler>();
            services.AddTransient <IIntentHandler, IntentHandler>();
            services.AddTransient <IStatusHandler, StatusHandler>();
            services.AddTransient <IEmailSubscriptionHandler, EmailSubscriptionHandler>();

            services.AddTransient <IIntent, AmazonHelpIntent>();
            services.AddTransient <IIntent, AmazonStopIntent>();
            services.AddTransient <IIntent, AmazonCancelIntent>();
            services.AddTransient <IIntent, GetOverviewDayIntent>();
            services.AddTransient <IIntent, ToggleEmailSettingsIntent>();
            services.AddTransient <IIntent, SetUserPreferencesIntent>();
            services.AddTransient <IIntent, ResetUserPreferencesIntent>();
            services.AddTransient <ICinemaDialogWorker, CinemaDialogWorker>();

            services.AddTransient <IKinoheldService, KinoheldService>();
            services.AddTransient <IKinoheldDbAccess, KinoheldDbAccess>();

            services.AddSingleton <IMessages>(MessageCreator.CreateMessages());
            services.AddSingleton <IAmazonService, AmazonService>();
            services.AddSingleton <IEmailService, EmailService>();
            services.AddSingleton <IRandomGenerator, RandomGenerator>();

            services.AddSingleton <IEmailBodyFormatter <DayOverview>, OverviewEmailFormatter>();
            services.AddSingleton <ISsmlMessageFormatter <DayOverview>, AlexaOverviewByShowResponseFormatter>();

            services.AddSingleton <IWorkItemQueue, WorkItemQueue>();
        }