llbl 2.0
orm 2.0.7.810
adapter
domain:
BatchEntity 1:N ReportEntity
ReportEntity 1:1 ReportDataEntity (heirachy)
batch is a logical grouping of reports.
report is a single report related to a specific batch
reportdata is the actual report as a byte array. this way i don't need to fetch the bytes with each call.
scenario:
within the database exists a record for batch and associated report records. no records exist for reportdata at this point. (Only a request for the reports is saved, the actually report has not be generated.)
does this code work?
IPrefetchPath2 prefetch = new PrefetchPath2((int)EntityType.BatchEntity);
prefetch.Add(BatchEntity.PrefetchPathReport);
ReportBatchEntity batch = new ReportBatchEntity(1);
adapter.FetchEntity(batch, null, prefetch);
foreach(ReportDataEntity dataOfReport in batch.Reports)
{
dataOfReport.Data = GenerateReportAsByteArray();
dataOfReport.Status = StatusEnum.Completed;
}
uow.AddForSave(batch);
uow.commit(adapter, true); **
Note I prefetch ReportEntities but a enumerate over ReportDATAEntities.
Data is a property of ReportData entity.
Status is a property of Report entity.
** expected psuedo sql
begin tran
insert into report_data_tbl (id, data) values (1, byte[])
update report_tbl set status = 3 where id = 1
commit tran
are these assumptions correct?