Exemple #1
0
        private static void InitialiseRepositories()
        {
            var sqlConnection = ConfigurationManager.ConnectionStrings["PetAdoptionContextConnection"].ConnectionString;

            var builder = new DbContextOptionsBuilder <PetAdoptionContext>();

            builder.UseSqlServer(sqlConnection);

            var petAdoptionContext = new PetAdoptionContext(builder.Options);

            //DbInitialiser.Initialize(petAdoptionContext);

            _dogRepository = new DogRepository(petAdoptionContext); // new Context.PetAdoptionContext(null, null));
            _catRepository = new CatRepository(petAdoptionContext); // new Context.PetAdoptionContext(null, null));
        }
Exemple #2
0
 public PetServiceDb(PetAdoptionContext context)
 {
     _context = context;
 }
 public DogRepository(PetAdoptionContext context)
 {
     _context = context;
 }