wtijsma wrote:
Edit: Basically I want to be able to experiment with lock hints like this: "WITH (updlock, readpast)", that are more specific than the transaction isolation level can specify, can you help me out with that?
Ok. The way the hints work is that they are added to the "FROM [Table] [Hints]" if there is any hint to add. That means that you have to use the FROM clause in the query. So this query for example don't look for hints:
UPDATE [Table] SET Field = value WHERE...
However this query does add hints:
UPDATE [Table] SET Field = value FROM [Table INNER JOIN ...] WHERE...
I'm attaching an example implementation of UPDLOCK adapter, similar to the NoLock example. You have to put it in your DBSpecific project. Then you can use it this way:
// new value for the customer
CustomerEntity customer = new CustomerEntity();
customer.CompanyName = customer.CompanyName + "...";
// build the filter. In this case only the Customer "ALFKIi" will be updated
var filter = new RelationPredicateBucket(CustomerFields.CustomerId == "ALFKI");
// this is needed so the framework will look for hints. We will add any related entity
filter.Relations.Add(CustomerEntity.Relations.OrderEntityUsingCustomerId);
// update
using (var updLockAdapter = new UpdLockAdapter())
{
int rowsAffected = updLockAdapter.UpdateEntitiesDirectly(customer, filter);
}
It's the same for UpdateEntitiesDirectly.