Esempio n. 1
0
        private static void DevelopmentData(FlyballDbContext context)
        {
            var ripItUp = context.Clubs.FirstOrDefault(x => x.NafaClubNumber == 987);

            if (ripItUp == null)
            {
                context.Clubs.Add(RipItUp);
            }
        }
Esempio n. 2
0
 private static void PositionPopulate(FlyballDbContext context)
 {
     foreach (var position in Position.List())
     {
         var val = context.Positions.FirstOrDefault(x => x.Name == position.Name);
         if (val == null)
         {
             context.Positions.Add(position);
         }
     }
 }
        public InMemoryDbFixture()
        {
            var options = new DbContextOptionsBuilder <FlyballDbContext>()
                          .UseInMemoryDatabase(databaseName: "InMemoryTesting")
                          .Options;

            Context = new FlyballDbContext(options);
            // SeedData.PopulateTestData(Context);

            Context.Database.EnsureCreated();
        }
Esempio n. 4
0
 private static void FaultPopulate(FlyballDbContext context)
 {
     foreach (var fault in Fault.List())
     {
         var val = context.Faults.FirstOrDefault(x => x.Name == fault.Name);
         if (val == null)
         {
             context.Faults.Add(fault);
         }
     }
 }
Esempio n. 5
0
 private static void LaneSidePopulate(FlyballDbContext context)
 {
     foreach (var lane in LaneSide.List())
     {
         var val = context.Lane.FirstOrDefault(x => x.Name == lane.Name);
         if (val == null)
         {
             context.Lane.Add(lane);
         }
     }
 }
Esempio n. 6
0
 private static void OutcomePopulate(FlyballDbContext context)
 {
     foreach (var outcome in Outcome.List())
     {
         var val = context.Outcomes.FirstOrDefault(x => x.Name == outcome.Name);
         if (val == null)
         {
             context.Outcomes.Add(outcome);
         }
     }
 }
Esempio n. 7
0
 private static void RacingClassPopulate(FlyballDbContext context)
 {
     foreach (var racingClass in RacingClass.List())
     {
         var val = context.RacingClasses.FirstOrDefault(x => x.Name == racingClass.Name);
         if (val == null)
         {
             context.RacingClasses.Add(racingClass);
         }
     }
 }
Esempio n. 8
0
        public static FlyballDbContext GetContext(string dbName)
        {
            var options = new DbContextOptionsBuilder <FlyballDbContext>()
                          .UseInMemoryDatabase(databaseName: dbName)
                          .Options;

            var context = new FlyballDbContext(options);

            context.Database.EnsureCreated();

            return(context);
        }
Esempio n. 9
0
        public static void PopulateData(FlyballDbContext context, bool IsDevelopment)
        {
            RacingClassPopulate(context);
            FaultPopulate(context);
            LaneSidePopulate(context);
            PositionPopulate(context);
            OutcomePopulate(context);

            if (IsDevelopment)
            {
                DevelopmentData(context);
            }

            context.SaveChanges();
        }
Esempio n. 10
0
        public static void PopulateTestData(FlyballDbContext context)
        {
            Sheridan.Flyball.Data.EFCore.SeedData.PopulateData(context);
            context.Clubs.Add(ModelSetup.SetupClubWithPeople());
            context.Clubs.Add(ModelSetup.SetupClubWithNoPeople());

            var tournament = ModelSetup.KingsTournament;

            tournament.AddDivision(ModelSetup.Open1);
            tournament.AddDivision(ModelSetup.Open2);
            tournament.AddDivision(ModelSetup.Regular1);
            tournament.AddDivision(ModelSetup.Regular2);
            tournament.AddRaceYear(ModelSetup.CurrentRaceYear);

            tournament.AddRace(ModelSetup.Race1LeftSide);
            tournament.AddRace(ModelSetup.Race1RightSide);



            context.SaveChanges();
        }
 public TournamentRepository(FlyballDbContext dbContext) : base(dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 12
0
 public static IClubRepository ClubRepository(FlyballDbContext context)
 {
     return(new ClubRepository(context));
 }
Esempio n. 13
0
 public DogRepository(FlyballDbContext dbContext) : base(dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 14
0
 public DivisionRepository(FlyballDbContext dbContext) : base(dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 15
0
 public RaceRepository(FlyballDbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 16
0
 public static IDogRepository DogRepository(FlyballDbContext context)
 {
     return(new DogRepository(context));
 }
Esempio n. 17
0
 public static IPersonRepository PersonRepository(FlyballDbContext context)
 {
     return(new PersonRepository(context));
 }
Esempio n. 18
0
 public RaceYearRepository(FlyballDbContext dbContext) : base(dbContext)
 {
     _dbContext = dbContext;
 }
 public PersonRepository(FlyballDbContext dbContext) : base(dbContext)
 {
     _dbContext = dbContext;
 }