Nov 2, 2014 at 6:42 PM
Edited Nov 2, 2014 at 8:13 PM
In your code you open transaction and close transaction
Decision to commit or not to commit inside of this transaction is a parameter?!
When transaction is closed (by tran.Dispose or automatically in the end of using statement) DBreeze will automatically rollback all not committed operations. So your example should not work correctly and will call a mass of physical rollbacks chaining big processing
time and incorrect results.
You can open transaction outside the Insert-Procedure and give it to Insert-Procedure as a parameter.
Different threads can work with different transactions who, in turn, can possibly work with the same table. Such case must be synchronized by tran.SynchronizeTable command. Transaction can't be supplied from one thread to another by DBreeze rules. All this
can be found in docu.
Try to work with DBreeze yourself, before making DB provider based on it.
Approaches can be different in compare with other databases.
Dbreeze can be expressed very simply.
Either you insert batches or just one record into 1-N tables.
Use this pattern
using(var tran = engine.getTransaction())
//Batch or simple inserts
//...other db operations
use such simple scheme and DBreeze will help you in coding.