Esempio n. 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <MusicTheoryConfiguration>(Configuration);

            var musicTheoryConfiguration = new MusicTheoryConfiguration();

            Configuration.Bind(musicTheoryConfiguration);

            services.AddSingleton(x => musicTheoryConfiguration);

            services.AddControllersWithViews();
            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
            services.AddScoped <ILessonService, LessonService>();
            services.AddScoped <ILessonRepository, LessonRepository>();
            services.AddScoped <IOptionRepositoryFactory, OptionRepositoryFactory>();
        }
Esempio n. 2
0
 public LessonService(ILessonRepository repository, IOptions <MusicTheoryConfiguration> config, IOptionRepositoryFactory optionRepositoryFactory)
 {
     _repository = repository;
     _config     = config.Value;
     _optionRepositoryFactory = optionRepositoryFactory;
 }