Example #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var PatientOptions = new DbContextOptionsBuilder <PatientContext>()
                                 .UseInMemoryDatabase("Patients").Options;
            var DrugOptions = new DbContextOptionsBuilder <DrugContext>()
                              .UseInMemoryDatabase("Drugs").Options;
            var DosagesOptions = new DbContextOptionsBuilder <DosageContext>()
                                 .UseInMemoryDatabase("Dosage").Options;

            var PatientCont = new PatientContext(PatientOptions);
            var DrugCont    = new DrugContext(DrugOptions);
            var DosageCont  = new DosageContext(DosagesOptions);

            IRelationshipService Relationship = new RelationshipService(PatientCont,
                                                                        DrugCont,
                                                                        DosageCont);

            services.AddSingleton(Relationship);

            services.AddDbContext <PatientContext>(opt =>
                                                   opt.UseInMemoryDatabase("Patients"));
            services.AddDbContext <DrugContext>(opt =>
                                                opt.UseInMemoryDatabase("Drugs"));
            services.AddDbContext <DosageContext>(opt =>
                                                  opt.UseInMemoryDatabase("Dosage"));
            services.AddControllers();
        }
Example #2
0
 public RelationshipService(PatientContext patc, DrugContext drugc, DosageContext dosagec)
 {
     _patientContext = patc;
     _drugContext    = drugc;
     _dosageContext  = dosagec;
 }
Example #3
0
 public DosagesController(DosageContext context, IRelationshipService irs)
 {
     _context             = context;
     _relationshipService = irs;
 }