public async Task <OutputEquipment> Create(Equipment equipment, Flags flags, CancellationToken token = default) { var result = new OutputEquipment { DetailsId = equipment.DetailsId, Id = equipment.Id, Available = equipment.Available }; if ((flags & Flags.Details) != 0) { DetailsHandler = DetailsHandler ?? throw new ArgumentNullException(nameof(DetailsHandler)); if (equipment.Details == null) { await _context.Entry(equipment) .Reference(row => row.Details) .LoadAsync(token); } result.Details = await DetailsHandler.Create(equipment.Details, _detailsFlags, token); } return(result); }
public OutputEquipmentHandler Bind(OutputEquipmentDetailsHandler handler) { DetailsHandler = handler; handler.EquipmentHandler = this; return(this); }