diff --git a/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/RoleStore.cs b/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/RoleStore.cs index f91393165..2f69a8e2d 100644 --- a/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/RoleStore.cs +++ b/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/RoleStore.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore { @@ -263,7 +264,7 @@ private async Task SaveChanges(CancellationToken cancellationToken) throw new ArgumentNullException(nameof(role)); } role.Name = roleName; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -354,7 +355,7 @@ public virtual string ConvertIdToString(TKey id) throw new ArgumentNullException(nameof(role)); } role.NormalizedName = normalizedName; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// diff --git a/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/UserStore.cs b/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/UserStore.cs index 22cc54bbe..ddfb80eec 100644 --- a/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/UserStore.cs +++ b/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/UserStore.cs @@ -10,6 +10,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore { @@ -291,7 +292,7 @@ public UserStore(TContext context, IdentityErrorDescriber describer = null) /// The that represents the asynchronous operation. protected Task SaveChanges(CancellationToken cancellationToken) { - return AutoSaveChanges ? Context.SaveChangesAsync(cancellationToken) : Task.FromResult(0); + return AutoSaveChanges ? Context.SaveChangesAsync(cancellationToken) : TaskCache.CompletedTask; } /// @@ -344,7 +345,7 @@ protected Task SaveChanges(CancellationToken cancellationToken) throw new ArgumentNullException(nameof(user)); } user.UserName = userName; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -380,7 +381,7 @@ protected Task SaveChanges(CancellationToken cancellationToken) throw new ArgumentNullException(nameof(user)); } user.NormalizedUserName = normalizedName; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -541,7 +542,7 @@ public virtual IQueryable Users throw new ArgumentNullException(nameof(user)); } user.PasswordHash = passwordHash; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -933,7 +934,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.EmailConfirmed = confirmed; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -952,7 +953,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.Email = email; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -1007,7 +1008,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.NormalizedEmail = normalizedEmail; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -1062,7 +1063,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.LockoutEnd = lockoutEnd; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -1099,7 +1100,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.AccessFailedCount = 0; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -1154,7 +1155,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.LockoutEnabled = enabled; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -1173,7 +1174,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.PhoneNumber = phoneNumber; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -1229,7 +1230,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.PhoneNumberConfirmed = confirmed; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -1248,7 +1249,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.SecurityStamp = stamp; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// @@ -1285,7 +1286,7 @@ public async virtual Task FindByLoginAsync(string loginProvider, string p throw new ArgumentNullException(nameof(user)); } user.TwoFactorEnabled = enabled; - return Task.FromResult(0); + return TaskCache.CompletedTask; } /// diff --git a/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/project.json b/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/project.json index 966caf36f..b153b5154 100644 --- a/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/project.json +++ b/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/project.json @@ -20,7 +20,11 @@ }, "dependencies": { "Microsoft.AspNetCore.Identity": "1.1.0-*", - "Microsoft.EntityFrameworkCore.Relational": "1.1.0-*" + "Microsoft.EntityFrameworkCore.Relational": "1.1.0-*", + "Microsoft.Extensions.TaskCache.Sources": { + "version": "1.1.0-*", + "type": "build" + } }, "frameworks": { "net451": {}, diff --git a/src/Microsoft.AspNetCore.Identity/SignInManager.cs b/src/Microsoft.AspNetCore.Identity/SignInManager.cs index 26840f65d..c2034ab76 100644 --- a/src/Microsoft.AspNetCore.Identity/SignInManager.cs +++ b/src/Microsoft.AspNetCore.Identity/SignInManager.cs @@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Authentication; using Microsoft.AspNetCore.Http.Features.Authentication; +using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -662,7 +663,7 @@ private Task ResetLockout(TUser user) { return UserManager.ResetAccessFailedCountAsync(user); } - return Task.FromResult(0); + return TaskCache.CompletedTask; } internal class TwoFactorAuthenticationInfo diff --git a/src/Microsoft.AspNetCore.Identity/project.json b/src/Microsoft.AspNetCore.Identity/project.json index a354a9cc8..9ec9f0783 100644 --- a/src/Microsoft.AspNetCore.Identity/project.json +++ b/src/Microsoft.AspNetCore.Identity/project.json @@ -20,7 +20,11 @@ "dependencies": { "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0-*", "Microsoft.AspNetCore.Cryptography.KeyDerivation": "1.1.0-*", - "Microsoft.AspNetCore.Hosting.Abstractions": "1.1.0-*" + "Microsoft.AspNetCore.Hosting.Abstractions": "1.1.0-*", + "Microsoft.Extensions.TaskCache.Sources": { + "version": "1.1.0-*", + "type": "build" + } }, "frameworks": { "net451": {},