コード例 #1
0
        public UnitOfWork(PetStoreContext context)
        {
            _context    = context;
            UserAddress = new UserAddressRepository(_context);
            Products    = new ProductRepository(_context);

            Orders     = new OrderRepository(_context);
            OrderItems = new OrderItemRepository(_context);

            ShoppingCarts     = new ShoppingCartRepository(_context);
            ShoppingCartItems = new ShoppingCartItemRepository(_context);

            Pets     = new PetRepository(_context);
            PetTypes = new PetTypeRepository(_context);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            IPetRepository petRepository = new PetRepository();

            IPetTypeRepository petTypeRepository = new PetTypeRepository();

            IOwnerRepository ownerRepository = new OwnerRepository();

            IPetService petService = new PetService(petRepository, ownerRepository, petTypeRepository);

            IOwnerService ownerService = new OwnerService(ownerRepository, petRepository);

            FakeDB.InitData();



            Printer print = new Printer(petService, ownerService);

            print.PrintMenu();
        }