예제 #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();
        }