Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Builder and extensions cleanup #283

Merged
merged 4 commits into from
Apr 21, 2015
Merged

Builder and extensions cleanup #283

merged 4 commits into from
Apr 21, 2015

Conversation

Tratcher
Copy link
Member

#265

Hosting changes to follow.
@davidfowl @muratg

@ghost ghost added the cla-already-signed label Apr 17, 2015
@Tratcher
Copy link
Member Author

aspnet/Hosting@7acee4d

@@ -20,27 +20,13 @@ public MapWhenMiddleware([NotNull] RequestDelegate next, [NotNull] MapWhenOption

public async Task Invoke([NotNull] HttpContext context)
{
if (_options.Predicate != null)
if (_options.Predicate(context))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need a null check anymore? The setter for this property doesn't seem to guard against null.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NotNull guard is here:
https://github.com/aspnet/HttpAbstractions/pull/283/files#diff-93bfbc9b10d86e70f618ce3182ccfbeaL27

It used to check before because there were two different options, sync or async.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a guard on the method, not on the actual options class. Someone can still go to the options and make it null, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With effort. They would have to do app.Use(next => new MapWhenMiddleware(next, options).Invoke); since we don't provide an extension that takes the options directly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, true. Can we add a [NotNull] to the setter anyway? That way there would be no doubt.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@davidfowl
Copy link
Member

Where's the implicit conversion from string -> PathString

@Tratcher
Copy link
Member Author

@davidfowl
Copy link
Member

Part of the removal of the string methods was about adding that conversion. Did that get lost as well? /cc @glennc @muratg

@Tratcher
Copy link
Member Author

Ah, I misread that feedback. I thought it was asking to remove any implicit type conversions between string and PathString. I'll update the bug and the PR.

@Tratcher
Copy link
Member Author

Updated with implicit string converters.

@Eilon
Copy link
Contributor

Eilon commented Apr 20, 2015

:shipit:

1 similar comment
@davidfowl
Copy link
Member

:shipit:

@@ -5,12 +5,11 @@
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Builder.Extensions;
using Microsoft.Framework.Internal;

namespace Microsoft.AspNet.Builder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We totally need to change this namespace

@Tratcher Tratcher merged commit 0737ea3 into dev Apr 21, 2015
@Tratcher Tratcher deleted the Builder265 branch April 21, 2015 15:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants