private void InitializeRepositories() { if (_persist) { var context = new FilmContext(); context.Films.AddRange(Infrastructure.ConcreteRepositories.SeedCollection._baseFilmList); context.People.AddRange(SeedCollection._basePersonList); context.Countries.AddRange(SeedCollection._baseCountryList); context.Locations.AddRange(SeedCollection._baseLocationList); CountryRepository = new Infrastructure.ConcreteRepositories.EntityFramework.EFCountryRepository(context); FilmCountryRepository = new EFFilmCountryRepository(context); FilmPersonRepository = new EFFilmPersonRepository(context); FilmRepository = new EFFilmRepository(context); LocationRepository = new EFLocationRepository(context); PersonRepository = new EFPersonRepository(context); } else { CountryRepository = new InMemoryCountryRepository(new List <Country>()); CountryRepository.AddRange(SeedCollection._baseCountryList); FilmCountryRepository = new InMemoryFilmCountryRepository(new List <FilmCountry>()); FilmPersonRepository = new InMemoryFilmPersonRepository(new List <FilmPerson>()); FilmRepository = new InMemoryFilmRepository(new List <Film>()); FilmRepository.AddRange(SeedCollection._baseFilmList); LocationRepository = new InMemoryLocationRepository(new List <Location>()); LocationRepository.AddRange(SeedCollection._baseLocationList); PersonRepository = new InMemoryPersonRepository(new List <Person>()); PersonRepository.AddRange(SeedCollection._basePersonList); }; }
public PersonService(EFPersonRepository context) { _context = context; }