/// <summary> /// This method gets called by the runtime. Use this method to add services to the container. /// </summary> public void ConfigureServices(IServiceCollection services) { DtoMapping.WebApiConfigure(); // Register the IConfiguration instance which MyOptions binds against. services.Configure <MyOptions>(Configuration.GetSection("MyOptions")); // Add framework services. services.AddDbContext <LovePlatformContext>(options => options.UseMySql(Configuration.GetConnectionString("DefaultConnection"))); services.AddMvc(options => { options.Filters.Add(new ValidateModelAttribute()); options.Filters.Add(new CustomExceptionFilterAttribute()); }).AddJsonOptions(op => op.SerializerSettings.ContractResolver = new DefaultContractResolver()); // Add application services. services.AddScoped <PatientService>(); services.AddScoped <WeightService>(); services.AddScoped <UserService>(); services.AddScoped <TreatService>(); services.AddScoped <TreatImageService>(); services.AddScoped <DiagnoseService>(); services.AddScoped <OssService>(); services.AddScoped <UserService>(); services.AddScoped <BloodPressureService>(); services.AddScoped <PatientRepository>(); services.AddScoped <WeightRepository>(); services.AddScoped <UserRepository>(); services.AddScoped <TreatRepository>(); services.AddScoped <TreatImageRepository>(); services.AddScoped <DiagnoseRepository>(); services.AddScoped <OssRepository>(); services.AddScoped <UserRepository>(); services.AddScoped <BloodPressureRepository>(); services.AddScoped <IUnitWork, UnitWork>(); // Register the Swagger generator, defining one or more Swagger documents services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "WebAPI", Version = "v1" }); //Set the comments path for the swagger json and ui. var basePath = PlatformServices.Default.Application.ApplicationBasePath; var webapiXmlPath = Path.Combine(basePath, "LovePlatform.WebAPI.xml"); c.IncludeXmlComments(webapiXmlPath); var domainXmlPath = Path.Combine(basePath, "LovePlatform.DTO.xml"); c.IncludeXmlComments(domainXmlPath); }); }
/// <summary> /// This method gets called by the runtime. Use this method to add services to the container. /// </summary> /// <param name="services"></param> public void ConfigureServices(IServiceCollection services) { DtoMapping.WebApiConfigure(); // 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"))); services.AddMvc(options => { options.Filters.Add(new ValidateModelAttribute()); options.Filters.Add(new CustomExceptionFilterAttribute()); }).AddJsonOptions(op => op.SerializerSettings.ContractResolver = new DefaultContractResolver()); // Add application services. services.AddScoped <ShiftService>(); services.AddScoped <ShiftRepository>(); services.AddScoped <PatientService>(); services.AddScoped <PatientRepository>(); services.AddScoped <PatientContactService>(); services.AddScoped <PatientContactRepository>(); services.AddScoped <DoctorService>(); services.AddScoped <DoctorRepository>(); services.AddScoped <BloodPressureService>(); services.AddScoped <BloodPressureRepository>(); services.AddScoped <WeightService>(); services.AddScoped <WeightRepository>(); services.AddScoped <DialysisService>(); services.AddScoped <DialysisRepository>(); services.AddScoped <PatientEduService>(); services.AddScoped <PatientEduRepository>(); services.AddScoped <CourseRepository>(); services.AddScoped <FoodNutritionService>(); services.AddScoped <FoodNutritionRepository>(); services.AddScoped <HandRingService>(); services.AddScoped <HandRingRepository>(); services.AddScoped <HospitalRepository>(); services.AddScoped <InfomationService>(); services.AddScoped <InfomationRepository>(); services.AddScoped <MessageService>(); services.AddScoped <MessageRepository>(); services.AddScoped <SystemService>(); services.AddScoped <SystemRepository>(); services.AddScoped <AlarmService>(); services.AddScoped <AlarmRepository>(); services.AddScoped <WaterService>(); services.AddScoped <WaterRepository>(); services.AddScoped <BloodSugarService>(); services.AddScoped <BloodSugarRepository>(); services.AddScoped <OssRepository, OssRepository>(); services.AddScoped <IUnitWork, UnitWork>(); // Register the Swagger generator, defining one or more Swagger documents services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "血透标准版 API", Version = "v1" }); //Set the comments path for the swagger json and ui. var basePath = PlatformServices.Default.Application.ApplicationBasePath; var webapiXmlPath = Path.Combine(basePath, "Dialysis.WebApi.xml"); c.IncludeXmlComments(webapiXmlPath); var domainXmlPath = Path.Combine(basePath, "Dialysis.Dto.xml"); c.IncludeXmlComments(domainXmlPath); }); }