private static void DevelopmentData(FlyballDbContext context) { var ripItUp = context.Clubs.FirstOrDefault(x => x.NafaClubNumber == 987); if (ripItUp == null) { context.Clubs.Add(RipItUp); } }
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(); }
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); } } }
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); } } }
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); } } }
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); } } }
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); }
public static void PopulateData(FlyballDbContext context, bool IsDevelopment) { RacingClassPopulate(context); FaultPopulate(context); LaneSidePopulate(context); PositionPopulate(context); OutcomePopulate(context); if (IsDevelopment) { DevelopmentData(context); } context.SaveChanges(); }
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; }
public static IClubRepository ClubRepository(FlyballDbContext context) { return(new ClubRepository(context)); }
public DogRepository(FlyballDbContext dbContext) : base(dbContext) { _dbContext = dbContext; }
public DivisionRepository(FlyballDbContext dbContext) : base(dbContext) { _dbContext = dbContext; }
public RaceRepository(FlyballDbContext dbContext) : base(dbContext) { }
public static IDogRepository DogRepository(FlyballDbContext context) { return(new DogRepository(context)); }
public static IPersonRepository PersonRepository(FlyballDbContext context) { return(new PersonRepository(context)); }
public RaceYearRepository(FlyballDbContext dbContext) : base(dbContext) { _dbContext = dbContext; }
public PersonRepository(FlyballDbContext dbContext) : base(dbContext) { _dbContext = dbContext; }