Ejemplo n.º 1
0
        private static void Main()
        {
            using (var dataContext = new HotelDataContext())
            {
                var cityRepository = new Repository<City>(dataContext);

                City city = cityRepository
                    .SearchFor(c => c.Name.StartsWith("Paris"))
                    .Single();

                var hotelRepository = new HotelRepository(dataContext);

                IEnumerable<Hotel> orderedHotels = hotelRepository
                    .FindHotelsByCity(city);

                Console.WriteLine("* Hotels in {0} *", city.Name);

                foreach (Hotel orderedHotel in orderedHotels)
                {
                    Console.WriteLine(orderedHotel.Name);
                }

                Console.ReadKey();
            }
        }
Ejemplo n.º 2
0
        private static void Main()
        {
            using (var dataContext = new HotelDataContext())
            {
                var cityRepository = new Repository <City>(dataContext);

                City city = cityRepository
                            .SearchFor(c => c.Name.StartsWith("Paris"))
                            .Single();

                var hotelRepository = new HotelRepository(dataContext);

                IEnumerable <Hotel> orderedHotels = hotelRepository
                                                    .FindHotelsByCity(city);

                Console.WriteLine("* Hotels in {0} *", city.Name);

                foreach (Hotel orderedHotel in orderedHotels)
                {
                    Console.WriteLine(orderedHotel.Name);
                }

                Console.ReadKey();
            }
        }
Ejemplo n.º 3
0
 public BaseRepository(HotelDataContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }
Ejemplo n.º 4
0
 public UnitOfWork(HotelDataContext dbContext)
 {
     _dbContext = dbContext;
 }