public bool SeedDatabase(CcgDbContext dbContext) { // // Only use CcgDbContext created by migration // _dbContext = dbContext; var db = new UnitOfWork(); SeedRoles(db); SeedCCGs(db); SeedContactTypes(db); dbContext.SaveChanges(); SeedAppUsers(db); dbContext.SaveChanges(); SeedAppUsersRoles(db); dbContext.SaveChanges(); SeedMembers(db); dbContext.SaveChanges(); SeedContactRecords(db); dbContext.SaveChanges(); AssignUserIdToContactRecord(db); dbContext.SaveChanges(); SeedPrayerRequests(db); dbContext.SaveChanges(); SeedNeedsCommunion(db); dbContext.SaveChanges(); return(true); }
/// <summary> /// Returns member by id. /// </summary> /// <param name="id"></param> /// <param name="dbContext"></param> /// <returns></returns> public CCGMember FindMemberByIdLazyLoading(int?id, CcgDbContext dbContext) { if (id == null) { return(null); } var dbSet = context.Set <CCGMember>(); return(dbSet.Include("CCG").SingleOrDefault(m => m.Id == id)); }
public void SeedDatabase(CcgDbContext dbContext) { _dbContext = dbContext; // No using block to let the migration dispose of the context var db = new UnitOfWork(); SeedRoles(db); SeedCCGs(db); SeedContactTypes(db); _dbContext.SaveChanges(); }
public ContactRecordRepository(CcgDbContext context) : base(context) { }
public UnitOfWork() { context = new CcgDbContext(); }
public CCGRepository(CcgDbContext context) : base(context) { }
public RoleRepository(CcgDbContext context) : base(context) { }
public MemberRepository(CcgDbContext context) : base(context) { }
public PassAlongContactRepository(CcgDbContext context) : base(context) { }
public ChangeRequestRepository(CcgDbContext context) : base(context) { }
public NeedsCommunionRepository(CcgDbContext context) : base(context) { }
public ContactTypeRepository(CcgDbContext context) : base(context) { }
public AppUserRepository(CcgDbContext context) : base(context) { }
public virtual void Save(CcgDbContext context) { context.SaveChanges(); }
protected GenericRepository(CcgDbContext context) { this.context = context; this.dbSet = context.Set <TEntity>(); }