Skip to content

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

Merged
merged 3 commits into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
253 changes: 0 additions & 253 deletions AsyncGenerator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,259 +28,6 @@
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: CoreMemoryCache\NHibernate.Caches.CoreMemoryCache\NHibernate.Caches.CoreMemoryCache.csproj
Copy link
Member Author

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.

targetFramework: net461
concurrentRun: true
applyChanges: true
analyzation:
methodConversion:
- conversion: Ignore
hasAttributeName: ObsoleteAttribute
callForwarding: true
cancellationTokens:
guards: true
methodParameter:
- anyInterfaceRule: PubliclyExposedType
parameter: Optional
- parameter: Optional
rule: PubliclyExposedType
- parameter: Required
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
transformation:
configureAwaitArgument: false
localFunctions: true
asyncLock:
type: NHibernate.Util.AsyncLock
methodName: LockAsync
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: EnyimMemcached\NHibernate.Caches.EnyimMemcached\NHibernate.Caches.EnyimMemcached.csproj
concurrentRun: true
applyChanges: true
analyzation:
methodConversion:
- conversion: Ignore
hasAttributeName: ObsoleteAttribute
callForwarding: true
cancellationTokens:
guards: true
methodParameter:
- anyInterfaceRule: PubliclyExposedType
parameter: Optional
- parameter: Optional
rule: PubliclyExposedType
- parameter: Required
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
transformation:
configureAwaitArgument: false
localFunctions: true
asyncLock:
type: NHibernate.Util.AsyncLock
methodName: LockAsync
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: MemCache\NHibernate.Caches.MemCache\NHibernate.Caches.MemCache.csproj
concurrentRun: true
applyChanges: true
analyzation:
methodConversion:
- conversion: Ignore
hasAttributeName: ObsoleteAttribute
callForwarding: true
cancellationTokens:
guards: true
methodParameter:
- anyInterfaceRule: PubliclyExposedType
parameter: Optional
- parameter: Optional
rule: PubliclyExposedType
- parameter: Required
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
transformation:
configureAwaitArgument: false
localFunctions: true
asyncLock:
type: NHibernate.Util.AsyncLock
methodName: LockAsync
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: Prevalence\NHibernate.Caches.Prevalence\NHibernate.Caches.Prevalence.csproj
concurrentRun: true
applyChanges: true
analyzation:
methodConversion:
- conversion: Ignore
hasAttributeName: ObsoleteAttribute
callForwarding: true
cancellationTokens:
guards: true
methodParameter:
- anyInterfaceRule: PubliclyExposedType
parameter: Optional
- parameter: Optional
rule: PubliclyExposedType
- parameter: Required
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
transformation:
configureAwaitArgument: false
localFunctions: true
asyncLock:
type: NHibernate.Util.AsyncLock
methodName: LockAsync
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: RtMemoryCache\NHibernate.Caches.RtMemoryCache\NHibernate.Caches.RtMemoryCache.csproj
concurrentRun: true
applyChanges: true
analyzation:
methodConversion:
- conversion: Ignore
hasAttributeName: ObsoleteAttribute
callForwarding: true
cancellationTokens:
guards: true
methodParameter:
- anyInterfaceRule: PubliclyExposedType
parameter: Optional
- parameter: Optional
rule: PubliclyExposedType
- parameter: Required
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
transformation:
configureAwaitArgument: false
localFunctions: true
asyncLock:
type: NHibernate.Util.AsyncLock
methodName: LockAsync
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: SharedCache\NHibernate.Caches.SharedCache\NHibernate.Caches.SharedCache.csproj
concurrentRun: true
applyChanges: true
analyzation:
methodConversion:
- conversion: Ignore
hasAttributeName: ObsoleteAttribute
callForwarding: true
cancellationTokens:
guards: true
methodParameter:
- anyInterfaceRule: PubliclyExposedType
parameter: Optional
- parameter: Optional
rule: PubliclyExposedType
- parameter: Required
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
transformation:
configureAwaitArgument: false
localFunctions: true
asyncLock:
type: NHibernate.Util.AsyncLock
methodName: LockAsync
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: SysCache\NHibernate.Caches.SysCache\NHibernate.Caches.SysCache.csproj
concurrentRun: true
applyChanges: true
analyzation:
methodConversion:
- conversion: Ignore
hasAttributeName: ObsoleteAttribute
callForwarding: true
cancellationTokens:
guards: true
methodParameter:
- anyInterfaceRule: PubliclyExposedType
parameter: Optional
- parameter: Optional
rule: PubliclyExposedType
- parameter: Required
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
transformation:
configureAwaitArgument: false
localFunctions: true
asyncLock:
type: NHibernate.Util.AsyncLock
methodName: LockAsync
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: SysCache2\NHibernate.Caches.SysCache2\NHibernate.Caches.SysCache2.csproj
concurrentRun: true
applyChanges: true
analyzation:
methodConversion:
- conversion: Ignore
hasAttributeName: ObsoleteAttribute
callForwarding: true
cancellationTokens:
guards: true
methodParameter:
- anyInterfaceRule: PubliclyExposedType
parameter: Optional
- parameter: Optional
rule: PubliclyExposedType
- parameter: Required
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
transformation:
configureAwaitArgument: false
localFunctions: true
asyncLock:
type: NHibernate.Util.AsyncLock
methodName: LockAsync
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: Velocity\NHibernate.Caches.Velocity\NHibernate.Caches.Velocity.csproj
concurrentRun: true
applyChanges: true
analyzation:
methodConversion:
- conversion: Ignore
hasAttributeName: ObsoleteAttribute
callForwarding: true
cancellationTokens:
guards: true
methodParameter:
- anyInterfaceRule: PubliclyExposedType
parameter: Optional
- parameter: Optional
rule: PubliclyExposedType
- parameter: Required
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
transformation:
configureAwaitArgument: false
localFunctions: true
asyncLock:
type: NHibernate.Util.AsyncLock
methodName: LockAsync
registerPlugin:
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
assemblyName: AsyncGenerator.Core
- filePath: NHibernate.Caches.Common.Tests\NHibernate.Caches.Common.Tests.csproj
targetFramework: net461
concurrentRun: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Distributed;
using NHibernate.Caches.Util;
using NHibernate.Util;

namespace NHibernate.Caches.CoreDistributedCache
{
using System.Threading.Tasks;
using System.Threading;
public partial class CoreDistributedCache : ICache

public abstract partial class CoreDistributedCacheBase : CacheBase
{

/// <inheritdoc />
public async Task<object> GetAsync(object key, CancellationToken cancellationToken)
public override async Task<object> GetAsync(object key, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
if (key == null)
Expand All @@ -49,7 +50,7 @@ public async Task<object> GetAsync(object key, CancellationToken cancellationTok
}

/// <inheritdoc />
public Task PutAsync(object key, object value, CancellationToken cancellationToken)
public override Task PutAsync(object key, object value, CancellationToken cancellationToken)
{
if (key == null)
{
Expand Down Expand Up @@ -93,7 +94,7 @@ public Task PutAsync(object key, object value, CancellationToken cancellationTok
}

/// <inheritdoc />
public Task RemoveAsync(object key, CancellationToken cancellationToken)
public override Task RemoveAsync(object key, CancellationToken cancellationToken)
{
if (key == null)
{
Expand All @@ -117,7 +118,7 @@ public Task RemoveAsync(object key, CancellationToken cancellationToken)
}

/// <inheritdoc />
public Task ClearAsync(CancellationToken cancellationToken)
public override Task ClearAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
Expand All @@ -135,16 +136,15 @@ public Task ClearAsync(CancellationToken cancellationToken)
}

/// <inheritdoc />
public Task LockAsync(object key, CancellationToken cancellationToken)
public override Task<object> LockAsync(object key, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return Task.FromCanceled<object>(cancellationToken);
}
try
{
Lock(key);
return Task.CompletedTask;
return Task.FromResult<object>(Lock(key));
}
catch (Exception ex)
{
Expand All @@ -153,15 +153,15 @@ public Task LockAsync(object key, CancellationToken cancellationToken)
}

/// <inheritdoc />
public Task UnlockAsync(object key, CancellationToken cancellationToken)
public override Task UnlockAsync(object key, object lockValue, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return Task.FromCanceled<object>(cancellationToken);
}
try
{
Unlock(key);
Unlock(key, lockValue);
return Task.CompletedTask;
}
catch (Exception ex)
Expand Down
Loading