From 85402d4bd6a64bc216bab1ff50d9b19a4f97db79 Mon Sep 17 00:00:00 2001 From: Chris R Date: Wed, 28 Jun 2017 14:52:14 -0700 Subject: [PATCH] Add CancellationToken to ISession Load/CommitAsync --- .../ISession.cs | 5 +++-- .../breakingchanges.netcore.json | 20 +++++++++++++++++++ .../DefaultHttpContextTests.cs | 5 +++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.AspNetCore.Http.Features/ISession.cs b/src/Microsoft.AspNetCore.Http.Features/ISession.cs index c2dc435801..6bd780684d 100644 --- a/src/Microsoft.AspNetCore.Http.Features/ISession.cs +++ b/src/Microsoft.AspNetCore.Http.Features/ISession.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace Microsoft.AspNetCore.Http @@ -28,13 +29,13 @@ namespace Microsoft.AspNetCore.Http /// Load the session from the data store. This may throw if the data store is unavailable. /// /// - Task LoadAsync(); + Task LoadAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Store the session in the data store. This may throw if the data store is unavailable. /// /// - Task CommitAsync(); + Task CommitAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Retrieve the value of the given key, if present. diff --git a/src/Microsoft.AspNetCore.Http.Features/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Http.Features/breakingchanges.netcore.json index 7bdc58b355..96eb5548c5 100644 --- a/src/Microsoft.AspNetCore.Http.Features/breakingchanges.netcore.json +++ b/src/Microsoft.AspNetCore.Http.Features/breakingchanges.netcore.json @@ -8,5 +8,25 @@ "TypeId": "public interface Microsoft.AspNetCore.Http.IHeaderDictionary : System.Collections.Generic.IDictionary", "MemberId": "System.Void set_ContentLength(System.Nullable value)", "Kind": "Addition" + }, + { + "TypeId": "public interface Microsoft.AspNetCore.Http.ISession", + "MemberId": "System.Threading.Tasks.Task CommitAsync()", + "Kind": "Removal" + }, + { + "TypeId": "public interface Microsoft.AspNetCore.Http.ISession", + "MemberId": "System.Threading.Tasks.Task LoadAsync()", + "Kind": "Removal" + }, + { + "TypeId": "public interface Microsoft.AspNetCore.Http.ISession", + "MemberId": "System.Threading.Tasks.Task CommitAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))", + "Kind": "Addition" + }, + { + "TypeId": "public interface Microsoft.AspNetCore.Http.ISession", + "MemberId": "System.Threading.Tasks.Task LoadAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))", + "Kind": "Addition" } ] \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Http.Tests/DefaultHttpContextTests.cs b/test/Microsoft.AspNetCore.Http.Tests/DefaultHttpContextTests.cs index 2327db1ce9..6463880f6e 100644 --- a/test/Microsoft.AspNetCore.Http.Tests/DefaultHttpContextTests.cs +++ b/test/Microsoft.AspNetCore.Http.Tests/DefaultHttpContextTests.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Net.WebSockets; using System.Reflection; using System.Security.Claims; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; using Xunit; @@ -301,12 +302,12 @@ namespace Microsoft.AspNetCore.Http _store.Clear(); } - public Task CommitAsync() + public Task CommitAsync(CancellationToken cancellationToken) { return Task.FromResult(0); } - public Task LoadAsync() + public Task LoadAsync(CancellationToken cancellationToken) { return Task.FromResult(0); }