Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddDbContext <MyCareDBContext>(option =>
            {
                option.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
            });

            var myCareDbContext = new MyCareDBContext();

            services.AddScoped <IPeopleRepository>(sp => new PeopleRepository(myCareDbContext));
            services.AddScoped <ITimesheetRepository>(sp => new TimesheetRepository(myCareDbContext));
            services.AddScoped <IPeopleService, PeopleService>();
            services.AddScoped <ITimesheetService, TimesheetService>();
        }
Пример #2
0
 public TimesheetRepository(MyCareDBContext myCareDbContext) : base(myCareDbContext)
 {
 }
Пример #3
0
 public PeopleRepository(MyCareDBContext myCareDbContext) : base(myCareDbContext)
 {
 }