Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        /// <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));
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
 public ContactRecordRepository(CcgDbContext context) : base(context)
 {
 }
Exemplo n.º 5
0
 public UnitOfWork()
 {
     context = new CcgDbContext();
 }
 public CCGRepository(CcgDbContext context) : base(context)
 {
 }
Exemplo n.º 7
0
 public RoleRepository(CcgDbContext context) : base(context)
 {
 }
Exemplo n.º 8
0
 public MemberRepository(CcgDbContext context) : base(context)
 {
 }
Exemplo n.º 9
0
 public PassAlongContactRepository(CcgDbContext context) : base(context)
 {
 }
Exemplo n.º 10
0
 public ChangeRequestRepository(CcgDbContext context) : base(context)
 {
 }
 public NeedsCommunionRepository(CcgDbContext context) : base(context)
 {
 }
Exemplo n.º 12
0
 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>();
 }