-
Notifications
You must be signed in to change notification settings - Fork 31
Upgrade to NH 5.2.0 #56
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
Upgrade to NH 5.2.0 #56
Conversation
Done with binary breaking changes
This change requires .Net Core 2.1 SDK
@@ -28,259 +28,6 @@ | |||
registerPlugin: | |||
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover | |||
assemblyName: AsyncGenerator.Core | |||
- filePath: CoreMemoryCache\NHibernate.Caches.CoreMemoryCache\NHibernate.Caches.CoreMemoryCache.csproj |
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.
Most caches do no more need an async generation, as their cache implementation do not support async. The inherited default async handling is then suitable for them.
/// <summary> | ||
/// Pluggable cache implementation using <see cref="IDistributedCache"/> implementations. | ||
/// </summary> | ||
public partial class CoreDistributedCache : ICache | ||
public class CoreDistributedCache : CoreDistributedCacheBase, |
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.
For avoiding binary breaking changes, I only see this ugly solution.
Removing a non-virtual method for a virtual inherited one is a breaking change, as some caller may try to call
it, as explained here:
Adding virtual to a member
While this change would often work without breaking too many scenarios because C# compiler tends to emitcallvirt
IL instructions to call non-virtual methods (callvirt
performs a null check, while a normalcall
won't), we can't rely on it. C# is not the only language we target and the C# compiler increasingly tries to optimizecallvirt
to a normalcall
whenever the target method is non-virtual and thethis
is provably not null (such as a method accessed through the?.
null propagation operator). Making a method virtual would mean that consumer code would often end up calling it non-virtually.
And we are in a worst case: we have removed many of these members (all the async ones for all the other caches), counting on virtual inherited ones for replacing them.
Moreover the old void Lock
cannot coexist with object Lock
in the same class, so we anyway need an "intermediate" class.
public class CoreDistributedCache : CoreDistributedCacheBase, | ||
#pragma warning disable 618 | ||
ICache | ||
#pragma warning restore 618 |
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.
We do not need it for avoiding a binary breaking change, but it avoids having to rewrite all the XML comments.
I intend to merge this soon, in order to allow other pending PR to be done. |
In order to benefit from the
CacheBase
(nhibernate/nhibernate-core#1777), upgrade to NHibernate 5.2.0.