strongloop/loopback-connector-mssql — pull request #16 by bitmage (2014-12-08 21:00:33+00:00)
Title: fixed race condition causing incorrect IDs to be reported on INSERT

When sending multiple INSERT operations to the MSSQL driver asynchronously, sometimes the IDs are incorrectly reported. I have observed 1) all the IDs being the same, 2) some IDs misreported, others correct. This is because the INSERT and SELECT commands in MsSQL.prototype.create are not atomic. This change makes them atomic by wrapping them in a transaction.

Correct results are really important here - this was causing my foreign-key relationships to be configured incorrectly, which is a loss of data integrity.

I don't see a strong rationale for testing this, as it would be difficult to replicate, and would introduce indeterminacy into your test suite.