예제 #1
0
        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();
            };
        }
예제 #2
0
        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();
                }
            };
        }
예제 #3
0
 public TradeOffersRepository(StudentifyDbContext context,
                              ISelectRepository <TradeOffer> selectRepository,
                              IInsertRepository <TradeOffer> insertRepository,
                              IUpdateRepository <TradeOffer> updateRepository
                              ) : base(context, selectRepository)
 {
     Insert = insertRepository;
     Update = updateRepository;
 }
예제 #4
0
 public MeetingsRepository(StudentifyDbContext context,
                           ISelectRepository <Meeting> selectRepository,
                           IInsertRepository <Meeting> insertRepository,
                           IUpdateRepository <Meeting> updateRepository
                           ) : base(context, selectRepository)
 {
     Insert = insertRepository;
     Update = updateRepository;
 }
예제 #5
0
 public InfosRepository(StudentifyDbContext context,
                        ISelectRepository <Info> selectRepository,
                        IInsertRepository <Info> insertRepository,
                        IUpdateRepository <Info> updateRepository
                        ) : base(context, selectRepository)
 {
     Insert = insertRepository;
     Update = updateRepository;
 }
예제 #6
0
        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;
        }
예제 #8
0
        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();
        }
예제 #9
0
        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();
                }
            };
        }
예제 #10
0
 public StudentifyEventsRepository(StudentifyDbContext context,
                                   ISelectRepository <StudentifyEvent> selectRepository,
                                   IDeleteRepository <StudentifyEvent> deleteRepository) : base(context, selectRepository)
 {
     Delete = deleteRepository;
 }
예제 #11
0
 public DeleteRepositoryBase(StudentifyDbContext context) : base(context)
 {
 }
예제 #12
0
 public RepositoryBase(StudentifyDbContext context)
 {
     Context = context;
 }
 public StudentifyEventRepositorySelectBase(StudentifyDbContext context, ISelectRepository <T> selectRepository) : base(context)
 {
     Select = selectRepository;
     Select.FillWithReferences += FillWithReferences;
 }
예제 #14
0
 public InsertRepositoryBase(StudentifyDbContext context) : base(context)
 {
 }
예제 #15
0
 public SelectRepositoryBase(StudentifyDbContext context) : base(context)
 {
 }