protected void ValidSubmit(EditContext context) { using (var transaction = PinhuaContext.Database.BeginTransaction()) { try { PinhuaContext.RecordEdit <dto字典, tb_字典表>(main); Action <dto字典D> adding = item => { item.字典号 = main.字典号; item.组号 = main.组号; }; Action <dto字典D> updating = item => { item.字典号 = main.字典号; item.组号 = main.组号; }; var remote = PinhuaContext.RecordDetailsEdit <dto字典, dto字典D, tb_字典表, tb_字典表D>(main, detailsTableDataSource, adding, updating); PinhuaContext.SaveChanges(); transaction.Commit(); Navigation.NavigateTo(routeA); } catch (Exception) { transaction.Rollback(); } } }