Open xamele0n opened 2 years ago
Fix #303 #298 #274 Requesting @valfrid-ly for review
@xamele0n Do you happen to have created a nuget package with this fix that you can share? :)
Nm. I made one myself: https://www.nuget.org/packages/Swush.DapperExtensions/1.7.1-hotfix-concurrency
It's basically just the code from this PR. Do note that it only supports .net 6 and 7.
Anyway - deployed the fix on production - and got the same error as described in #298 almost immediately. So this does not fix #298 - unfortunately!
@skovsende - well.. i did`t noticed that fields are used outside forming sql. I did rewrite implementation according your case. You can try this.
Default SqlGenerator has properties
IList<IColumn> AllColumns { get; } IList<Table> MappedTables { get; }
that filled and modified in different methods. This data shared across methods inside SqlGenerator in non-threadsafe manner and it can be changed by differrent (parallel) thread. Whole sql statement must be composed by it`s own SqlGenerator