public static void AddAcademy(this IServiceCollection services, AcademyOptions options)
 {
     services.AddScoped <ICourseCategoryRepository, CourseCategoryRepository>();
     services.AddScoped <ICourseRepository, CourseRepository>();
     services.AddScoped <ICourseCategoryService, CourseCategoryService>();
     services.AddScoped <ICourseService, CourseService>();
     services.AddDbContext <AcademyContext>(a => a.ConfigForAcademy(options.ConnectionString));
     services.AddSingleton <IFilterHelper, KendoFilterHelper>();
 }
Esempio n. 2
0
        public static void AddAcademy(this IServiceCollection collection, AcademyOptions options)
        {
            //TODO: use batch registration here O_o
            collection.AddScoped <ICourseCategoryService, CourseCategoryService>();
            collection.AddScoped <ICourseCategoryRepository, CourseCategoryRepository>();

            collection.AddScoped <ICourseService, CourseService>();
            collection.AddScoped <ICourseRepository, CourseRepository>();

            collection.AddDbContext <AcademyContext>(builder =>
                                                     builder.UseSqlServer(options.ConnectionString));
        }