v2.6.9.116, sql server, vb.net 2008, adapter template
I am trying to set the CommitOrder on a unit of work but the CommitUnitOfWork seems to ignore it. Here is code from my manager class.
Public Shared Sub InsertDocument(ByVal equipmentId As Integer, ByVal document As DocumentEntity, ByVal isDefault As Boolean)
Dim eq As New EquipmentDocumentEntity()
eq.EquipmentId = equipmentId
eq.IsDefault = isDefault
eq.Document = document
Dim uow As New UnitOfWork2()
uow.AddForSave(eq)
uow.AddForSave(document)
If isDefault Then
Dim bucket As New RelationPredicateBucket()
bucket.PredicateExpression.Add(New FieldCompareValuePredicate(EquipmentDocumentFields.EquipmentId, Nothing, ComparisonOperator.Equal, equipmentId))
bucket.PredicateExpression.Add(New FieldCompareValuePredicate(EquipmentDocumentFields.IsDefault, Nothing, ComparisonOperator.Equal, True))
Dim defdoc As New EquipmentDocumentEntity
defdoc.IsDefault = False
uow.AddUpdateEntitiesDirectlyCall(defdoc, bucket)
uow.CommitOrder.Add(UnitOfWorkBlockType.UpdatesPerformedDirectly)
uow.CommitOrder.Add(UnitOfWorkBlockType.Inserts)
End If
CommitUnitOfWork(uow)
End Sub
The Inserts still get called before my UpdateEntitiesDirect calls. I tried changing the order that I added to the UnitOfWork and still no dice. What am I doing wrong?