I've just written a small test app that generates 10 threads, each of which instantiates an adapter instance. Each thread attempts 1000 add / update operations, inside a transaction, on the same table (add a new entity, add another entity, use UpdateEntitiesDirectly with a RelationPredicateBucket to update the previously added entity. I'm getting loads of exceptions thrown:
Transaction was deadlocked on {lock} resources with another process and has been chosen as the deadlock victim. Rerun the transaction...
The SQL is always the same:
UPDATE <TABLE> WHERE <TABLE>.parentId = @parentId1
I was under the impression that the adapter could be used from multiple threads as long as each thread has its own instance of the adapter. Or is it just the database (SQLServer) throwing a wobbly at having so many transactions started in a short space of time?