From 6f24508a332b2deb66a7c8ef1c3776673a7c2ab5 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Mon, 21 Mar 2016 08:47:12 -0700 Subject: [PATCH] Move remaining feature interfaces into `Microsoft.AspNetCore.Http.Features` package and namespace - #590, also related to #561 - move feature interfaces from `Microsoft.AspNetCore.Http` package - move required classes from `Microsoft.AspNetCore.Http.Abstractions` package - move `ISession` and `WebSocketAcceptContext` to `Microsoft.AspNetCore.Http` namespace (#590) nit: remove transient dependencies listed in `Microsoft.AspNetCore.Http.Abstractions`'s `project.json` --- src/Microsoft.AspNetCore.Http.Abstractions/project.json | 2 -- .../SessionExtensions.cs | 1 - .../CookieOptions.cs | 0 .../IFormCollection.cs | 6 +++--- .../IFormFeature.cs | 2 +- .../IFormFile.cs | 0 .../IFormFileCollection.cs | 0 .../IItemsFeature.cs | 2 +- .../IQueryCollection.cs | 7 ++++--- .../IQueryFeature.cs | 2 +- .../IRequestCookieCollection.cs | 8 ++++---- .../IRequestCookiesFeature.cs | 2 +- .../IResponseCookies.cs | 0 .../IResponseCookiesFeature.cs | 2 +- .../IServiceProvidersFeature.cs | 2 +- src/Microsoft.AspNetCore.Http.Features/ISession.cs | 2 +- .../WebSocketAcceptContext.cs | 2 +- src/Microsoft.AspNetCore.Http.Features/project.json | 1 + src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs | 2 +- .../WebSockets/OwinWebSocketAcceptAdapter.cs | 2 +- .../WebSockets/OwinWebSocketAcceptContext.cs | 2 +- .../WebSockets/WebSocketAcceptAdapter.cs | 2 +- .../DefaultHttpContextTests.cs | 3 +-- 23 files changed, 25 insertions(+), 27 deletions(-) rename src/{Microsoft.AspNetCore.Http.Abstractions => Microsoft.AspNetCore.Http.Features}/CookieOptions.cs (100%) rename src/{Microsoft.AspNetCore.Http.Abstractions => Microsoft.AspNetCore.Http.Features}/IFormCollection.cs (97%) rename src/{Microsoft.AspNetCore.Http/Features => Microsoft.AspNetCore.Http.Features}/IFormFeature.cs (94%) rename src/{Microsoft.AspNetCore.Http.Abstractions => Microsoft.AspNetCore.Http.Features}/IFormFile.cs (100%) rename src/{Microsoft.AspNetCore.Http.Abstractions => Microsoft.AspNetCore.Http.Features}/IFormFileCollection.cs (100%) rename src/{Microsoft.AspNetCore.Http/Features => Microsoft.AspNetCore.Http.Features}/IItemsFeature.cs (84%) rename src/{Microsoft.AspNetCore.Http.Abstractions => Microsoft.AspNetCore.Http.Features}/IQueryCollection.cs (94%) rename src/{Microsoft.AspNetCore.Http/Features => Microsoft.AspNetCore.Http.Features}/IQueryFeature.cs (83%) rename src/{Microsoft.AspNetCore.Http.Abstractions => Microsoft.AspNetCore.Http.Features}/IRequestCookieCollection.cs (96%) rename src/{Microsoft.AspNetCore.Http/Features => Microsoft.AspNetCore.Http.Features}/IRequestCookiesFeature.cs (83%) rename src/{Microsoft.AspNetCore.Http.Abstractions => Microsoft.AspNetCore.Http.Features}/IResponseCookies.cs (100%) rename src/{Microsoft.AspNetCore.Http/Features => Microsoft.AspNetCore.Http.Features}/IResponseCookiesFeature.cs (83%) rename src/{Microsoft.AspNetCore.Http/Features => Microsoft.AspNetCore.Http.Features}/IServiceProvidersFeature.cs (84%) diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/project.json b/src/Microsoft.AspNetCore.Http.Abstractions/project.json index 54cbd3da92..1ad6d728ad 100644 --- a/src/Microsoft.AspNetCore.Http.Abstractions/project.json +++ b/src/Microsoft.AspNetCore.Http.Abstractions/project.json @@ -29,10 +29,8 @@ }, "netstandard1.3": { "dependencies": { - "System.ComponentModel": "4.0.1-*", "System.Globalization.Extensions": "4.0.1-*", "System.Linq.Expressions": "4.0.11-*", - "System.Net.WebSockets": "4.0.0-*", "System.Reflection.TypeExtensions": "4.1.0-*", "System.Runtime.InteropServices": "4.1.0-*" }, diff --git a/src/Microsoft.AspNetCore.Http.Extensions/SessionExtensions.cs b/src/Microsoft.AspNetCore.Http.Extensions/SessionExtensions.cs index 859e6c3715..fd7573fa95 100644 --- a/src/Microsoft.AspNetCore.Http.Extensions/SessionExtensions.cs +++ b/src/Microsoft.AspNetCore.Http.Extensions/SessionExtensions.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Text; -using Microsoft.AspNetCore.Http.Features; namespace Microsoft.AspNetCore.Http { diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/CookieOptions.cs b/src/Microsoft.AspNetCore.Http.Features/CookieOptions.cs similarity index 100% rename from src/Microsoft.AspNetCore.Http.Abstractions/CookieOptions.cs rename to src/Microsoft.AspNetCore.Http.Features/CookieOptions.cs diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/IFormCollection.cs b/src/Microsoft.AspNetCore.Http.Features/IFormCollection.cs similarity index 97% rename from src/Microsoft.AspNetCore.Http.Abstractions/IFormCollection.cs rename to src/Microsoft.AspNetCore.Http.Features/IFormCollection.cs index 668afa61a8..3c382f1c4b 100644 --- a/src/Microsoft.AspNetCore.Http.Abstractions/IFormCollection.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IFormCollection.cs @@ -18,9 +18,9 @@ namespace Microsoft.AspNetCore.Http /// The number of elements contained in the . /// int Count { get; } - + /// - /// Gets an containing the keys of the + /// Gets an containing the keys of the /// . /// /// @@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Http /// key is null. /// /// - /// has a different indexer contract than + /// has a different indexer contract than /// , as it will return StringValues.Empty for missing entries /// rather than throwing an Exception. /// diff --git a/src/Microsoft.AspNetCore.Http/Features/IFormFeature.cs b/src/Microsoft.AspNetCore.Http.Features/IFormFeature.cs similarity index 94% rename from src/Microsoft.AspNetCore.Http/Features/IFormFeature.cs rename to src/Microsoft.AspNetCore.Http.Features/IFormFeature.cs index 4ed8ba238c..f10ed47b80 100644 --- a/src/Microsoft.AspNetCore.Http/Features/IFormFeature.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IFormFeature.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Microsoft.AspNetCore.Http.Features.Internal +namespace Microsoft.AspNetCore.Http.Features { public interface IFormFeature { diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/IFormFile.cs b/src/Microsoft.AspNetCore.Http.Features/IFormFile.cs similarity index 100% rename from src/Microsoft.AspNetCore.Http.Abstractions/IFormFile.cs rename to src/Microsoft.AspNetCore.Http.Features/IFormFile.cs diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/IFormFileCollection.cs b/src/Microsoft.AspNetCore.Http.Features/IFormFileCollection.cs similarity index 100% rename from src/Microsoft.AspNetCore.Http.Abstractions/IFormFileCollection.cs rename to src/Microsoft.AspNetCore.Http.Features/IFormFileCollection.cs diff --git a/src/Microsoft.AspNetCore.Http/Features/IItemsFeature.cs b/src/Microsoft.AspNetCore.Http.Features/IItemsFeature.cs similarity index 84% rename from src/Microsoft.AspNetCore.Http/Features/IItemsFeature.cs rename to src/Microsoft.AspNetCore.Http.Features/IItemsFeature.cs index 68f411b5c5..bea03e466c 100644 --- a/src/Microsoft.AspNetCore.Http/Features/IItemsFeature.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IItemsFeature.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.Http.Features.Internal +namespace Microsoft.AspNetCore.Http.Features { public interface IItemsFeature { diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/IQueryCollection.cs b/src/Microsoft.AspNetCore.Http.Features/IQueryCollection.cs similarity index 94% rename from src/Microsoft.AspNetCore.Http.Abstractions/IQueryCollection.cs rename to src/Microsoft.AspNetCore.Http.Features/IQueryCollection.cs index 48d8448b58..9df3a78024 100644 --- a/src/Microsoft.AspNetCore.Http.Abstractions/IQueryCollection.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IQueryCollection.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Http int Count { get; } /// - /// Gets an containing the keys of the + /// Gets an containing the keys of the /// . /// /// @@ -73,13 +73,14 @@ namespace Microsoft.AspNetCore.Http /// The key of the value to get. /// /// - /// The element with the specified key, or .Empty if the key is not present. + /// The element with the specified key, or . + /// Empty if the key is not present. /// /// /// key is null. /// /// - /// has a different indexer contract than + /// has a different indexer contract than /// , as it will return StringValues.Empty for missing entries /// rather than throwing an Exception. /// diff --git a/src/Microsoft.AspNetCore.Http/Features/IQueryFeature.cs b/src/Microsoft.AspNetCore.Http.Features/IQueryFeature.cs similarity index 83% rename from src/Microsoft.AspNetCore.Http/Features/IQueryFeature.cs rename to src/Microsoft.AspNetCore.Http.Features/IQueryFeature.cs index 3f89bd2b4c..4f307f8f90 100644 --- a/src/Microsoft.AspNetCore.Http/Features/IQueryFeature.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IQueryFeature.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Http.Features.Internal +namespace Microsoft.AspNetCore.Http.Features { public interface IQueryFeature { diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/IRequestCookieCollection.cs b/src/Microsoft.AspNetCore.Http.Features/IRequestCookieCollection.cs similarity index 96% rename from src/Microsoft.AspNetCore.Http.Abstractions/IRequestCookieCollection.cs rename to src/Microsoft.AspNetCore.Http.Features/IRequestCookieCollection.cs index 7fffe314fe..c1a7344cff 100644 --- a/src/Microsoft.AspNetCore.Http.Abstractions/IRequestCookieCollection.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IRequestCookieCollection.cs @@ -17,9 +17,9 @@ namespace Microsoft.AspNetCore.Http /// The number of elements contained in the . /// int Count { get; } - + /// - /// Gets an containing the keys of the + /// Gets an containing the keys of the /// . /// /// @@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Http /// that implements . /// ICollection Keys { get; } - + /// /// Determines whether the contains an element /// with the specified key. @@ -78,7 +78,7 @@ namespace Microsoft.AspNetCore.Http /// key is null. /// /// - /// has a different indexer contract than + /// has a different indexer contract than /// , as it will return String.Empty for missing entries /// rather than throwing an Exception. /// diff --git a/src/Microsoft.AspNetCore.Http/Features/IRequestCookiesFeature.cs b/src/Microsoft.AspNetCore.Http.Features/IRequestCookiesFeature.cs similarity index 83% rename from src/Microsoft.AspNetCore.Http/Features/IRequestCookiesFeature.cs rename to src/Microsoft.AspNetCore.Http.Features/IRequestCookiesFeature.cs index 58cf459a04..55ba603642 100644 --- a/src/Microsoft.AspNetCore.Http/Features/IRequestCookiesFeature.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IRequestCookiesFeature.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Http.Features.Internal +namespace Microsoft.AspNetCore.Http.Features { public interface IRequestCookiesFeature { diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/IResponseCookies.cs b/src/Microsoft.AspNetCore.Http.Features/IResponseCookies.cs similarity index 100% rename from src/Microsoft.AspNetCore.Http.Abstractions/IResponseCookies.cs rename to src/Microsoft.AspNetCore.Http.Features/IResponseCookies.cs diff --git a/src/Microsoft.AspNetCore.Http/Features/IResponseCookiesFeature.cs b/src/Microsoft.AspNetCore.Http.Features/IResponseCookiesFeature.cs similarity index 83% rename from src/Microsoft.AspNetCore.Http/Features/IResponseCookiesFeature.cs rename to src/Microsoft.AspNetCore.Http.Features/IResponseCookiesFeature.cs index 9277637217..fb5ea09258 100644 --- a/src/Microsoft.AspNetCore.Http/Features/IResponseCookiesFeature.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IResponseCookiesFeature.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Http.Features.Internal +namespace Microsoft.AspNetCore.Http.Features { public interface IResponseCookiesFeature { diff --git a/src/Microsoft.AspNetCore.Http/Features/IServiceProvidersFeature.cs b/src/Microsoft.AspNetCore.Http.Features/IServiceProvidersFeature.cs similarity index 84% rename from src/Microsoft.AspNetCore.Http/Features/IServiceProvidersFeature.cs rename to src/Microsoft.AspNetCore.Http.Features/IServiceProvidersFeature.cs index 9816f2fe33..aed0fc91de 100644 --- a/src/Microsoft.AspNetCore.Http/Features/IServiceProvidersFeature.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IServiceProvidersFeature.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNetCore.Http.Features.Internal +namespace Microsoft.AspNetCore.Http.Features { public interface IServiceProvidersFeature { diff --git a/src/Microsoft.AspNetCore.Http.Features/ISession.cs b/src/Microsoft.AspNetCore.Http.Features/ISession.cs index 05b846d814..0904703d39 100644 --- a/src/Microsoft.AspNetCore.Http.Features/ISession.cs +++ b/src/Microsoft.AspNetCore.Http.Features/ISession.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Microsoft.AspNetCore.Http.Features +namespace Microsoft.AspNetCore.Http { public interface ISession { diff --git a/src/Microsoft.AspNetCore.Http.Features/WebSocketAcceptContext.cs b/src/Microsoft.AspNetCore.Http.Features/WebSocketAcceptContext.cs index b2627f5575..5e3659d647 100644 --- a/src/Microsoft.AspNetCore.Http.Features/WebSocketAcceptContext.cs +++ b/src/Microsoft.AspNetCore.Http.Features/WebSocketAcceptContext.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Http.Features +namespace Microsoft.AspNetCore.Http { public class WebSocketAcceptContext { diff --git a/src/Microsoft.AspNetCore.Http.Features/project.json b/src/Microsoft.AspNetCore.Http.Features/project.json index 249c11436b..a6b8321019 100644 --- a/src/Microsoft.AspNetCore.Http.Features/project.json +++ b/src/Microsoft.AspNetCore.Http.Features/project.json @@ -21,6 +21,7 @@ "netstandard1.3": { "dependencies": { "System.Collections": "4.0.11-*", + "System.ComponentModel": "4.0.1-*", "System.Linq": "4.1.0-*", "System.Net.Primitives": "4.0.11-*", "System.Net.WebSockets": "4.0.0-*", diff --git a/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs b/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs index a69bcde215..fb0d954284 100644 --- a/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs +++ b/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs @@ -16,9 +16,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Http.Features.Internal; using Microsoft.AspNetCore.Http.Features.Authentication; using Microsoft.AspNetCore.Http.Features.Authentication.Internal; +using Microsoft.AspNetCore.Http.Features.Internal; namespace Microsoft.AspNetCore.Owin { diff --git a/src/Microsoft.AspNetCore.Owin/WebSockets/OwinWebSocketAcceptAdapter.cs b/src/Microsoft.AspNetCore.Owin/WebSockets/OwinWebSocketAcceptAdapter.cs index 3cee220f46..3833f39a91 100644 --- a/src/Microsoft.AspNetCore.Owin/WebSockets/OwinWebSocketAcceptAdapter.cs +++ b/src/Microsoft.AspNetCore.Owin/WebSockets/OwinWebSocketAcceptAdapter.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Net.WebSockets; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.Owin { diff --git a/src/Microsoft.AspNetCore.Owin/WebSockets/OwinWebSocketAcceptContext.cs b/src/Microsoft.AspNetCore.Owin/WebSockets/OwinWebSocketAcceptContext.cs index a891c9611f..a9fd28edba 100644 --- a/src/Microsoft.AspNetCore.Owin/WebSockets/OwinWebSocketAcceptContext.cs +++ b/src/Microsoft.AspNetCore.Owin/WebSockets/OwinWebSocketAcceptContext.cs @@ -2,7 +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 Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.Owin { diff --git a/src/Microsoft.AspNetCore.Owin/WebSockets/WebSocketAcceptAdapter.cs b/src/Microsoft.AspNetCore.Owin/WebSockets/WebSocketAcceptAdapter.cs index 41b1960cb2..a77eeb67ba 100644 --- a/src/Microsoft.AspNetCore.Owin/WebSockets/WebSocketAcceptAdapter.cs +++ b/src/Microsoft.AspNetCore.Owin/WebSockets/WebSocketAcceptAdapter.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Net.WebSockets; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.Owin { diff --git a/test/Microsoft.AspNetCore.Http.Tests/DefaultHttpContextTests.cs b/test/Microsoft.AspNetCore.Http.Tests/DefaultHttpContextTests.cs index a47c97a02a..fe58c81098 100644 --- a/test/Microsoft.AspNetCore.Http.Tests/DefaultHttpContextTests.cs +++ b/test/Microsoft.AspNetCore.Http.Tests/DefaultHttpContextTests.cs @@ -8,7 +8,6 @@ using System.Net.WebSockets; using System.Reflection; using System.Security.Claims; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Authentication.Internal; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features.Internal; using Xunit; @@ -204,7 +203,7 @@ namespace Microsoft.AspNetCore.Http.Internal var field = type .GetFields(BindingFlags.NonPublic | BindingFlags.Instance) - .Single(f => + .Single(f => f.FieldType.GetTypeInfo().IsGenericType && f.FieldType.GetGenericTypeDefinition() == typeof(FeatureReferences<>));