I am just curious how do know if a unit of work's commit operation has completed successfully.
For example, assuming I have a client table, I could write the following delete statemet: "Delete From Client Where ClientId = 1234". If I ran this in enterprise manager, it might or might not delete records. In any case, the SQL is valid and does execute.
I have a similar concept written in C# and I am trying to determine if the actual entities were deleted at runtime. Should I try and refetch the entities being deleted directly?
Or, better yet, what happens when you call UOW2.AddDeleteEntitiesDirectlyCall and there is no data to be deleted?
Here is my sample code:
internal override bool Delete(object UserId)
{
bool result = false;
if (UserId == null)
throw new ApplicationException(Properties.EvClientMembershipProvider.Msg_UserIdRequired);
Guid lUserId = (Guid)UserId;
using (DataAccessAdapterBase adapter = AdapterFactory.CreateAdapter())
{
UnitOfWork2 uow = new UnitOfWork2();
RelationPredicateBucket bucket = new RelationPredicateBucket(ClientUserFields.UserId == lUserId);
uow.AddDeleteEntitiesDirectlyCall("ClientUserEntity", bucket);
bucket = new RelationPredicateBucket(ClientContactFields.UserId == lUserId);
uow.AddDeleteEntitiesDirectlyCall("ClientContact", bucket);
uow.Commit(adapter, true);
result = true;
}
return result;
}