Esempio n. 1
0
        public static IServiceCollection AddForum(this IServiceCollection services, IConfiguration configuration)
        {
            RegisterRepositories(services, configuration);

            RegisterAzureStorage(services, configuration);

            services.Configure <ServiceModels.RecaptchaOptions>(configuration);
            services.AddTransient <IRecaptchaValidator, RecaptchaValidator>();
            services.AddTransient <ValidateRecaptchaActionFilter>();

            services.Configure <ServiceModels.EmailSenderOptions>(configuration);
            services.AddTransient <IEmailSender, EmailSender>();

            services.AddTransient <IImageStore, ImageStore>();
            services.AddTransient <IForumViewResult, ForumViewResult>();

            services.AddScoped <UserContext>();

            services.AddSingleton <IActionContextAccessor, ActionContextAccessor>();
            services.AddSingleton <IUrlHelperFactory, UrlHelperFactory>();

            services.AddSingleton((serviceProvider) => {
                return(BBCParserFactory.GetParser());
            });

            return(services);
        }
Esempio n. 2
0
        public static IServiceCollection AddForum(this IServiceCollection services)
        {
            RegisterRepositories(services);

            services.AddScoped <ActionLogService>();
            services.AddScoped <GzipWebClient>();
            services.AddScoped <UserContext>();
            services.AddScoped <UserContextLoader>();

            services.AddSingleton <IActionContextAccessor, ActionContextAccessor>();
            services.AddSingleton <IUrlHelperFactory, UrlHelperFactory>();

            services.AddSingleton((serviceProvider) => {
                return(BBCParserFactory.GetParser());
            });

            return(services);
        }