Пример #1
0
        public EfDbSetWrapper(AirTicketEfDbContext efDbContext)
        {
            Guard.WhenArgument(efDbContext, "efDbContext").IsNull().Throw();

            this.efDbContext = efDbContext;
            this.dbSet       = efDbContext.Set <T>();
        }
Пример #2
0
        public void TestCleanup()
        {
            AirTicketEfDbContext dbContext = kernel.Get <AirTicketEfDbContext>();

            dbContext.Airlines.Attach(dbAirline);
            dbContext.Airlines.Remove(dbAirline);

            dbContext.SaveChanges();
        }
Пример #3
0
        public void TestInit()
        {
            kernel = NinjectWebCommon.CreateKernel();
            AirTicketEfDbContext dbContext = kernel.Get <AirTicketEfDbContext>();

            dbContext.Airlines.Add(dbAirline);
            dbContext.SaveChanges();

            dbContext.Airports.Add(dbAirport);
            dbContext.SaveChanges();

            //var airline = dbContext.Airlines.FirstOrDefault();
            //dbFlight.AirlineId = airline.Id;
            //dbFlight.Airline = airline;

            dbContext.Flights.Add(dbFlight);
            dbContext.SaveChanges();
        }