-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark AddTypeHandlerImpl as obsolete and prevent lost updates via AddTypeHandler #2129
Conversation
- syncronize type-handler mutates, to prevent lost writes
(CI fails: appveyor keep changing the pgsql setup; trying to fix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not 100% perfect, but 99% on an admin / housekeeping operation will be fine.
what concrete scenario are you concerned about? |
giving up on fighting appveyor - summoning the one, the only, @NickCraver - any clue? appveyor keep changing the base image; I fixed once here, but can't get to work now |
Probably more a "not how I would do it" 1%. The iteration when newing the dictionary is still potentially an exception. At least it will throw an exception rather than build a non-desirable dictionary cache. But verily, if someone is running multi-threading add/reset/remove type handlers we could just tell them to not do it. I don't see that currently possible with the current code base, but more future proofing, because in 2 years will we remember this discussion? lol |
I don't see how:
So : in what scenario can we compete? Happy to consider a concrete scenario, but : I don't see it currently. As for the 2 years thing: we might not remember this specific discussion in the future, but yes: we will know that this is static state that needs concurrency consideration. |
Any potential issues does not exist currently in the code base and this PR is threaded sound. I'm confident this currently fixes the known threading issues and you should push it. (appveyor issues aside) Larger story here, I want Dapper to survive EF consuming this project as they often consume popular projects. Should we consider a |
I'm not sure that's the best option for configuration in this case. Over in the AOT side, we allow declarative and contextual configuration via attributes, which allows config to be as granular or global as desired without the need for additional registration or service tracking. |
I had a hard time doing static typemap configuration as Dapper and .net evolved regarding testing. AOT might be a great solution, but it is so far from on-the-ground developers just wanting things to work. The dotnet |
Because you can already do that today without requiring a new API. Service registration kinda needs a service state to be "proper" (not just static state), and the existing Dapper bits lack that. As for AOT: you don't need to be deploying via AOT for Dapper's AOT bits to be useful - the aim there is to remove all the reflection code from the critical path. |
Postgres fixed up in #2130 - the docs are just totally missing past Postgresql 13, so you're not crazy. Even more reason we need to get off AppVeyor. |
AddTypeHandlerImpl
was never intended to bepublic
; oopsalso drive-by fix to prevent lost updates via AddTypeHandler
fix #1815
alternate to #2107