This repository was archived by the owner on Nov 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 190
Less alloc/wrapping/boxing for Query, Forms, Cookies #411
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
94c04ff
Less alloc/wrapping/boxing for Query, Forms, Cookies
benaadams bd4a703
Remove StringSegment - dead code
benaadams 23cac46
Initial cr feedback
benaadams c251446
feedback changes
benaadams 046715b
cr feedback - slim interfaces
benaadams cd739bc
remove irrelevant interface implement
benaadams a0caefd
Move extension to existing Extenstions class
benaadams 90b8f4f
cr feedback
benaadams 003152d
Simplify Cookies Interface
benaadams File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,95 @@ | ||
// 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. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Extensions.Primitives; | ||
|
||
namespace Microsoft.AspNet.Http | ||
{ | ||
/// <summary> | ||
/// Contains the parsed form values. | ||
/// Represents the parsed form values sent with the HttpRequest. | ||
/// </summary> | ||
public interface IFormCollection : IReadableStringCollection | ||
public interface IFormCollection : IEnumerable<KeyValuePair<string, StringValues>> | ||
{ | ||
/// <summary> | ||
/// Gets the number of elements contained in the <see cref="T:Microsoft.AspNet.Http.IFormCollection" />. | ||
/// </summary> | ||
/// <returns> | ||
/// The number of elements contained in the <see cref="T:Microsoft.AspNet.Http.IFormCollection" />. | ||
/// </returns> | ||
int Count { get; } | ||
|
||
/// <summary> | ||
/// Gets an <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the | ||
/// <see cref="T:Microsoft.AspNet.Http.IFormCollection" />. | ||
/// </summary> | ||
/// <returns> | ||
/// An <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the object | ||
/// that implements <see cref="T:Microsoft.AspNet.Http.IFormCollection" />. | ||
/// </returns> | ||
ICollection<string> Keys { get; } | ||
|
||
/// <summary> | ||
/// Determines whether the <see cref="T:Microsoft.AspNet.Http.IFormCollection" /> contains an element | ||
/// with the specified key. | ||
/// </summary> | ||
/// <param name="key"> | ||
/// The key to locate in the <see cref="T:Microsoft.AspNet.Http.IFormCollection" />. | ||
/// </param> | ||
/// <returns> | ||
/// true if the <see cref="T:Microsoft.AspNet.Http.IFormCollection" /> contains an element with | ||
/// the key; otherwise, false. | ||
/// </returns> | ||
/// <exception cref="T:System.ArgumentNullException"> | ||
/// key is null. | ||
/// </exception> | ||
bool ContainsKey(string key); | ||
|
||
/// <summary> | ||
/// Gets the value associated with the specified key. | ||
/// </summary> | ||
/// <param name="key"> | ||
/// The key of the value to get. | ||
/// </param> | ||
/// <param name="value"> | ||
/// The key of the value to get. | ||
/// When this method returns, the value associated with the specified key, if the | ||
/// key is found; otherwise, the default value for the type of the value parameter. | ||
/// This parameter is passed uninitialized. | ||
/// </param> | ||
/// <returns> | ||
/// true if the object that implements <see cref="T:Microsoft.AspNet.Http.IFormCollection" /> contains | ||
/// an element with the specified key; otherwise, false. | ||
/// </returns> | ||
/// <exception cref="T:System.ArgumentNullException"> | ||
/// key is null. | ||
/// </exception> | ||
bool TryGetValue(string key, out StringValues value); | ||
|
||
/// <summary> | ||
/// Gets the value with the specified key. | ||
/// </summary> | ||
/// <param name="key"> | ||
/// The key of the value to get. | ||
/// </param> | ||
/// <returns> | ||
/// The element with the specified key, or <see cref="T:Microsoft.Extensions.Primitives.StringValues" />.Empty if the key is not present. | ||
/// </returns> | ||
/// <exception cref="T:System.ArgumentNullException"> | ||
/// key is null. | ||
/// </exception> | ||
/// <remarks> | ||
/// <see cref="T:Microsoft.AspNet.Http.IFormCollection" /> has a different indexer contract than | ||
/// <see cref="T:System.Collections.Generic.IDictionary`2" />, as it will return StringValues.Empty for missing entries | ||
/// rather than throwing an Exception. | ||
/// </remarks> | ||
StringValues this[string key] { get; } | ||
|
||
/// <summary> | ||
/// The file collection sent with the request. | ||
/// </summary> | ||
/// <param name="key"></param> | ||
/// <returns>The files included with the request.</returns> | ||
IFormFileCollection Files { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/Microsoft.AspNet.Http.Abstractions/IQueryCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// 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. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Extensions.Primitives; | ||
|
||
namespace Microsoft.AspNet.Http | ||
{ | ||
/// <summary> | ||
/// Represents the HttpRequest query string collection | ||
/// </summary> | ||
public interface IQueryCollection : IEnumerable<KeyValuePair<string, StringValues>> | ||
{ | ||
/// <summary> | ||
/// Gets the number of elements contained in the <see cref="T:Microsoft.AspNet.Http.IQueryCollection" />. | ||
/// </summary> | ||
/// <returns> | ||
/// The number of elements contained in the <see cref="T:Microsoft.AspNet.Http.IQueryCollection" />. | ||
/// </returns> | ||
int Count { get; } | ||
|
||
/// <summary> | ||
/// Gets an <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the | ||
/// <see cref="T:Microsoft.AspNet.Http.IQueryCollection" />. | ||
/// </summary> | ||
/// <returns> | ||
/// An <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the object | ||
/// that implements <see cref="T:Microsoft.AspNet.Http.IQueryCollection" />. | ||
/// </returns> | ||
ICollection<string> Keys { get; } | ||
|
||
/// <summary> | ||
/// Determines whether the <see cref="T:Microsoft.AspNet.Http.IQueryCollection" /> contains an element | ||
/// with the specified key. | ||
/// </summary> | ||
/// <param name="key"> | ||
/// The key to locate in the <see cref="T:Microsoft.AspNet.Http.IQueryCollection" />. | ||
/// </param> | ||
/// <returns> | ||
/// true if the <see cref="T:Microsoft.AspNet.Http.IQueryCollection" /> contains an element with | ||
/// the key; otherwise, false. | ||
/// </returns> | ||
/// <exception cref="T:System.ArgumentNullException"> | ||
/// key is null. | ||
/// </exception> | ||
bool ContainsKey(string key); | ||
|
||
/// <summary> | ||
/// Gets the value associated with the specified key. | ||
/// </summary> | ||
/// <param name="key"> | ||
/// The key of the value to get. | ||
/// </param> | ||
/// <param name="value"> | ||
/// The key of the value to get. | ||
/// When this method returns, the value associated with the specified key, if the | ||
/// key is found; otherwise, the default value for the type of the value parameter. | ||
/// This parameter is passed uninitialized. | ||
/// </param> | ||
/// <returns> | ||
/// true if the object that implements <see cref="T:Microsoft.AspNet.Http.IQueryCollection" /> contains | ||
/// an element with the specified key; otherwise, false. | ||
/// </returns> | ||
/// <exception cref="T:System.ArgumentNullException"> | ||
/// key is null. | ||
/// </exception> | ||
bool TryGetValue(string key, out StringValues value); | ||
|
||
/// <summary> | ||
/// Gets the value with the specified key. | ||
/// </summary> | ||
/// <param name="key"> | ||
/// The key of the value to get. | ||
/// </param> | ||
/// <returns> | ||
/// The element with the specified key, or <see cref="T:Microsoft.Extensions.Primitives.StringValues" />.Empty if the key is not present. | ||
/// </returns> | ||
/// <exception cref="T:System.ArgumentNullException"> | ||
/// key is null. | ||
/// </exception> | ||
/// <remarks> | ||
/// <see cref="T:Microsoft.AspNet.Http.IQueryCollection" /> has a different indexer contract than | ||
/// <see cref="T:System.Collections.Generic.IDictionary`2" />, as it will return StringValues.Empty for missing entries | ||
/// rather than throwing an Exception. | ||
/// </remarks> | ||
StringValues this[string key] { get; } | ||
} | ||
} |
39 changes: 0 additions & 39 deletions
39
src/Microsoft.AspNet.Http.Abstractions/IReadableStringCollection.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
More of a question, how is this more efficient?
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.
I don't think it is: #411 (comment)