Hi,
LLBLBGen 2.5
DataAdapter
I have a InvoiceEntity with a SequentialNumber property (that rappresenting the same field in DB). This SequentialNumber is based on Year and InvoiceType. So I have a unique SequentialNumber for each year and for each InvoiceType. For example I have this record:
InvoiceID Year InvoiceType SequentialNumber
1 2005 Type1 1
2 2005 Type1 2
3 2006 Type1 1
4 2006 Type2 1
5 2006 Type2 2
6 2007 Type1 1
7 2007 Type1 2
I save my InvoiceEntity and other related entities by a UnitOfWork2, and actually before Commit()'s call, i get the next SequentialNumber by an Adapter.GetScalar() and a PredicateExpression based on InvoiceType and Year:
InvoiceEntity invoice;
UnitOfWork2 uow;
invoice.SequentialNumber = GetNextSequentialNumber(InvoiceType, Year);
uow.AddForSave(invoice,true);
uow.Commit(....);
... but I know that this is an unsafe way in a distributed scenario
Are there any way in LLBL to execute the Adapter.GetScalar() (actually inside GetNextSequentialNumber method) call in the UnitOfWork2.Commit(), and so inside the InvoiceEntity saving transaction ?
regards
Davide