// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { DtoMapping.WebAdminConfigure(); // Register the IConfiguration instance which MyOptions binds against. services.Configure <MyOptions>(Configuration.GetSection("MyOptions")); services.AddDbContext <LovePlatformContext>(options => options.UseMySql(Configuration.GetConnectionString("DefaultConnection"), b => b.MigrationsAssembly("LovePlatform.WebAdmin"))); services.AddMvc(options => options.Filters.Add(new CustomExceptionFilterAttribute())) .AddJsonOptions(op => op.SerializerSettings.ContractResolver = new DefaultContractResolver());; services.AddSession(options => { options.CookieName = "LovePlatform"; }); // Add application services. services.AddScoped <LovePlatformAdminApi>(); services.AddScoped <AdministratorService>(); services.AddScoped <PatientService>(); services.AddScoped <WeightService>(); services.AddScoped <UserService>(); services.AddScoped <UserService>(); services.AddScoped <DiagnoseService>(); services.AddScoped <TreatService>(); services.AddScoped <TreatImageService>(); services.AddScoped <BloodPressureService>(); //Repository services.AddScoped <AdministratorRepository>(); services.AddScoped <PatientRepository>(); services.AddScoped <WeightRepository>(); services.AddScoped <UserRepository>(); services.AddScoped <DiagnoseRepository>(); services.AddScoped <TreatRepository>(); services.AddScoped <TreatImageRepository>(); services.AddScoped <BloodPressureRepository>(); services.AddScoped <IUnitWork, UnitWork>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { DtoMapping.WebAdminConfigure(); // Register the IConfiguration instance which MyOptions binds against. services.Configure <MyOptions>(Configuration.GetSection("MyOptions")); // Add framework services. services.AddDbContext <DialysisContext>(options => options.UseMySql(Configuration.GetConnectionString("DefaultConnection"), b => b.MigrationsAssembly("Dialysis.WebAdmin"))); services.AddMvc(options => options.Filters.Add(new CustomExceptionFilterAttribute())) .AddJsonOptions(op => op.SerializerSettings.ContractResolver = new DefaultContractResolver());; services.AddSession(options => { options.CookieName = "Dialysis"; }); // Add application services. //Service services.AddScoped <AlarmService>(); services.AddScoped <BloodPressureService>(); services.AddScoped <BloodSugarService>(); services.AddScoped <CourseCategoryService>(); services.AddScoped <CourseService>(); services.AddScoped <DialysisService>(); services.AddScoped <DoctorService>(); services.AddScoped <FoodNutritionService>(); services.AddScoped <HandRingService>(); services.AddScoped <HospitalService>(); services.AddScoped <InfomationService>(); services.AddScoped <MessageService>(); services.AddScoped <PatientContactService>(); services.AddScoped <PatientEduService>(); services.AddScoped <PatientService>(); services.AddScoped <ShiftService>(); services.AddScoped <SystemService>(); services.AddScoped <WaterService>(); services.AddScoped <WeightService>(); //Repository services.AddScoped <AlarmRepository>(); services.AddScoped <BloodPressureRepository>(); services.AddScoped <BloodSugarRepository>(); services.AddScoped <CourseRepository>(); services.AddScoped <DialysisRepository>(); services.AddScoped <DoctorRepository>(); services.AddScoped <FoodNutritionRepository>(); services.AddScoped <HandRingRepository>(); services.AddScoped <HospitalRepository>(); services.AddScoped <InfomationRepository>(); services.AddScoped <MessageRepository>(); services.AddScoped <OssRepository>(); services.AddScoped <PatientContactRepository>(); services.AddScoped <PatientEduRepository>(); services.AddScoped <PatientRepository>(); services.AddScoped <ShiftRepository>(); services.AddScoped <SystemRepository>(); services.AddScoped <WaterRepository>(); services.AddScoped <WeightRepository>(); services.AddScoped <IUnitWork, UnitWork>(); }