Thanks for the info. I think I'm understanding how it works more after some testing. I no longer have any locking issues after changing some code around, but I just want to get a confirmation on a few points, as it would still save me a lot of time. You might have already answered these but it would be great if you could just give me a definitive yes/no/explanation type answer to each of the following 3 points:
1) Does recursing into a graph of objects(which automatically queries the database) cause those queries to be attached to the same transaction as the parent? I.e.
//get a customer...
GlobalTransaction.Add(customerEntity);
//This next statement automatically queries the database for all orders for this customer
//will this query be part of the GlobalTransaction? This is important to know if I want to //control the islolation level of queries for child objects.
customerEntity.Order.Count
2)When saving a graph of objects will all sub-object sql also be part of the parent transaction? The documentation states it will save the entire graph in a ADO.NET transaction, but will this be the same as the parent? I.e.
//get a customer
GlobalTransaction.Add(customerEntity);
customerEntity.Order[0].Description = "new description";
//When this next statement is called will the Order object be saved as part of //GlobalTransaction? Or will it always be in it's own unique ADO.NET transaction
customerEntity.Save(true);
3)When you create a new object and then reference child collections from that new object why does it query the database? I.e.
CustomerEntity customerEntity = new CustomerEntity();
//fill customer fields
OrderEntity orderEntity = new OrderEntity();
//fill order fields
GlobalTransaction.Add(customerEntity);
//This next statement executes a query(select .... from order where customerid = 0). Why
//does it do this? The customer is new and could not possibly have any orders in the //database. If the answer to point 1 is 'No' then this makes it difficult to use the
//self-servicing model with transactions
customerEntity.Order.Add(orderEntity);
Anyhow thanks again for your responses. I think I'm starting to understand this better, but if could answer these points it would give me a definite picture of how my code should work...
Thanks!