public ThreadsRepository(StudentifyDbContext context, ISelectRepository <Thread> selectRepository, IInsertRepository <Thread> insertRepository, IUpdateRepository <Thread> updateRepository ) : base(context) { Insert = insertRepository; Update = updateRepository; Select = selectRepository; Select.FillWithReferences += async entities => { await Context.Entry(entities).Reference(t => t.UserAccount).LoadAsync(); var users = await Context.Set <StudentifyAccount>().ToListAsync(); foreach (var user in users) { await Context.Entry(user).Reference(i => i.User).LoadAsync(); } var studentifyEvents = await Context.Set <StudentifyEvent>().ToListAsync(); foreach (var studentifyEvent in studentifyEvents) { await Context.Entry(studentifyEvent).Reference(i => i.Address).LoadAsync(); } await Context.Entry(entities).Reference(t => t.ReferencedEvent).LoadAsync(); await Context.Entry(entities).Collection(t => t.Messages).LoadAsync(); }; }
public MessagesRepository(StudentifyDbContext context, ISelectRepository <Message> selectRepository, IInsertRepository <Message> insertRepository, IUpdateRepository <Message> updateRepository ) : base(context) { Insert = insertRepository; Update = updateRepository; Select = selectRepository; Select.FillWithReferences += async entities => { var threads = await Context.Set <Thread>().ToListAsync(); foreach (var thread in threads) { await Context.Entry(thread).Reference(t => t.UserAccount).LoadAsync(); await Context.Entry(thread).Collection(t => t.Messages).LoadAsync(); } var users = await Context.Set <StudentifyAccount>().ToListAsync(); foreach (var user in users) { await Context.Entry(user).Reference(i => i.User).LoadAsync(); } }; }
public TradeOffersRepository(StudentifyDbContext context, ISelectRepository <TradeOffer> selectRepository, IInsertRepository <TradeOffer> insertRepository, IUpdateRepository <TradeOffer> updateRepository ) : base(context, selectRepository) { Insert = insertRepository; Update = updateRepository; }
public MeetingsRepository(StudentifyDbContext context, ISelectRepository <Meeting> selectRepository, IInsertRepository <Meeting> insertRepository, IUpdateRepository <Meeting> updateRepository ) : base(context, selectRepository) { Insert = insertRepository; Update = updateRepository; }
public InfosRepository(StudentifyDbContext context, ISelectRepository <Info> selectRepository, IInsertRepository <Info> insertRepository, IUpdateRepository <Info> updateRepository ) : base(context, selectRepository) { Insert = insertRepository; Update = updateRepository; }
public void Setup() { _dbContextOptions = new DbContextOptionsBuilder <StudentifyDbContext>() .UseInMemoryDatabase(databaseName: "StudentifyDb") .Options; _context = new StudentifyDbContext(_dbContextOptions); _repository = new StudentifyAccountsRepository(_context, new SelectRepositoryBase <StudentifyAccount>(_context), new UpdateRepositoryBase <StudentifyAccount>(_context), new InsertRepositoryBase <StudentifyAccount>(_context)); }
public StudentifyAccountsRepository(StudentifyDbContext context, ISelectRepository <StudentifyAccount> selectRepository, IUpdateRepository <StudentifyAccount> updateRepository, IInsertRepository <StudentifyAccount> insertRepository) : base(context) { Update = updateRepository; Select = selectRepository; Select.FillWithReferences += async entities => { await Context.Entry(entities).Reference(i => i.User).LoadAsync(); await Context.Entry(entities).Collection(i => i.Skills).LoadAsync(); }; Insert = insertRepository; }
public void Setup() { _dbContextOptions = new DbContextOptionsBuilder <StudentifyDbContext>() .UseInMemoryDatabase(databaseName: "StudentifyDb") .Options; _context = new StudentifyDbContext(_dbContextOptions); _repository = new MessagesRepository(_context, new SelectRepositoryBase <Message>(_context), new InsertRepositoryBase <Message>(_context), new UpdateRepositoryBase <Message>(_context)); //Creating one dummy context for all messages _thread = new Thread { ReferencedEventId = 1 }; _context.Threads.Add(_thread); _context.SaveChanges(); }
public SkillsRepository(StudentifyDbContext context, ISelectRepository <Skill> selectRepository, IInsertRepository <Skill> insertRepository, IUpdateRepository <Skill> updateRepository ) : base(context) { Insert = insertRepository; Update = updateRepository; Select = selectRepository; Select.FillWithReferences += async entities => { await Context.Entry(entities).Reference(t => t.Owner).LoadAsync(); //await Context.Entry(entities).Collection(m => m.).LoadAsync(); var users = await Context.Set <StudentifyAccount>().ToListAsync(); foreach (var user in users) { await Context.Entry(user).Reference(i => i.User).LoadAsync(); } }; }
public StudentifyEventsRepository(StudentifyDbContext context, ISelectRepository <StudentifyEvent> selectRepository, IDeleteRepository <StudentifyEvent> deleteRepository) : base(context, selectRepository) { Delete = deleteRepository; }
public DeleteRepositoryBase(StudentifyDbContext context) : base(context) { }
public RepositoryBase(StudentifyDbContext context) { Context = context; }
public StudentifyEventRepositorySelectBase(StudentifyDbContext context, ISelectRepository <T> selectRepository) : base(context) { Select = selectRepository; Select.FillWithReferences += FillWithReferences; }
public InsertRepositoryBase(StudentifyDbContext context) : base(context) { }
public SelectRepositoryBase(StudentifyDbContext context) : base(context) { }