private async Task PerformInsertAsync(DataSet <SalesOrder> salesOrders, CancellationToken ct) { salesOrders._.ResetRowIdentifiers(); await SalesOrderHeader.InsertAsync(salesOrders, true, ct); var salesOrderDetails = salesOrders.GetChild(_ => _.SalesOrderDetails); salesOrderDetails._.ResetRowIdentifiers(); await SalesOrderDetail.InsertAsync(salesOrderDetails, ct); }
public async Task <int?> CreateSalesOrderAsync(DataSet <SalesOrderInfo> salesOrders, CancellationToken ct) { await EnsureConnectionOpenAsync(ct); using (var transaction = BeginTransaction()) { salesOrders._.ResetRowIdentifiers(); await SalesOrderHeader.InsertAsync(salesOrders, true, ct); var salesOrderDetails = salesOrders.GetChild(_ => _.SalesOrderDetails); salesOrderDetails._.ResetRowIdentifiers(); await SalesOrderDetail.InsertAsync(salesOrderDetails, ct); await transaction.CommitAsync(ct); return(salesOrders.Count > 0 ? salesOrders._.SalesOrderID[0] : null); } }