public static Flight ToDomain(this FlightRow row)
 {
     return(new Flight(
                row.Id,
                row.RowVersion.ToETag(),
                row.Routing.ToDomain(),
                row.Schedule.ToDomain(),
                row.PhysicalClassCapacities.ToDomain(),
                row.Bookings.ToDomain()
                ));
 }
        public async Task CreateAsync(Flight flight)
        {
            if (flight == null)
            {
                throw new ArgumentNullException(nameof(flight));
            }

            var row = new FlightRow();

            flight.MapTo(row);

            _dbContext.Flights.Add(row);
            await _dbContext.SaveChangesAsync();
        }
 public static void MapTo(this Flight flight, FlightRow row)
 {
     row.Id       = flight.Id;
     row.Routing  = flight.Routing.ToEntity();
     row.Schedule = flight.Schedule.ToEntity();
     row.PhysicalClassCapacities.SynchronizeWith(
         flight.Configuration,
         r => r.PhysicalClass,
         d => d.PhysicalClass,
         (r, d) => d.MapTo(r, flight));
     row.Bookings.SynchronizeWith(
         flight.Bookings,
         r => r.Id,
         d => d.Id,
         (r, d) => d.MapTo(r, flight));
 }
Beispiel #4
0
 public FlightRowChangeEvent(FlightRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }