-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Conversation
@@ -0,0 +1,48 @@ | |||
using System; |
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.
Put usings under the namspaces declaration human stylecop strike
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.
zOMG! Good job @thecodejunkie isn't watching!
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.
Problem is then you have to declare the Funcs with full names, e.g.
using AppFunc = System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>
So I think it's worth the tradeoff (what is the tradeoff, exactly? 😝)...
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.
Tbh, the funcs in owin are so much smaller these days I'm not sure I see the point in aliasing them.
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.
And the tradeoff is that putting them inside the namespace scopes them correctly, which can avoid issues with namespace collisions.. on the flip side, putting them outside of the namespace gets you stabbed in the belly by @thecodejunkie, who will grow a Sparta-eque beard just for the occasion.
Swings and roundabouts really.
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.
The latter is what turns up in intellisense though.
On 28 May 2014 09:26, "Kristian Hellang" notifications@github.com wrote:
In src/Nancy/Owin/DelegateExtensions.cs:
@@ -0,0 +1,48 @@
+using System;the funcs in owin are so much smaller these days I'm not sure I see the
point in aliasing them.It looks a bit nicer with
UseNancy(this Action)
than
UseNancy(this Action<Func<IDictionary<string, object>, Task>, Func<IDictionary<string, object>, Task>>)
[image: 😉]
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/1544/files#r13118572
.
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.
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 agree it looks fugly, but who cares about the signature anyway? As long as you get the extension methods 😄 This problem could probably be solved with your proposed global alias
?
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.
Probably not - aliases are only good within a project. AssemblyNeutral delegates would be nice though (if that even makes sense)
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.
In the name of consistency, which I value more, +1 for putting them inside the namespace scope. I do this and live with it.
Something is very wrong with this PR.. it's from @khellang and Travis has actually built without errors |
Its Sunday, Travis takes the day off |
lol. yeah, crazy! I just popped a 🍺 to celebrate! 😉 |
Reckon we could get this in 0.23? |
Could do.. tbh the most important part is probably obsoleting the old extension method, although I am still not sure what the message should be. There is value in having the owin stuff in core though I suppose. |
/// <param name="builder">The application builder delegate.</param> | ||
/// <param name="action">A configuration builder action.</param> | ||
/// <returns>The application builder delegate.</returns> | ||
public static Action<MiddlewareFunc> UseNancy(this Action<MiddlewareFunc> builder, Action<NancyOptions> action) |
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.
The suggested builder signature is Action<IDictionary<string, object>, MidFunc>
... which isn't even a proposal yet.
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.
Say what? No one's said this was BuildFunc. I assume you're hinting at the name? Do you have a suggestion?
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.
Right, ignore moi
Keep Nancy.Owin - IAppBuilder and owin.dll will be around for some time yet. +1 to moving NancyOwinHost to core. Though I'd rename it to NancyMiddleware myself, because Owin Hosts are things like Nowin, HttpListener etc. |
And |
After we get some consensus on the |
Move em inside :) |
Done... mmm, so much better. not 😉 |
@@ -16,7 +16,7 @@ | |||
/// <summary> | |||
/// Nancy host for OWIN hosts |
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.
its not a host?? 😄
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.
Happy now? 😄
wtf travis lol |
Travis build failed.. be good to see if any @NancyFx/most-valued-minions can restart it. |
Come on then @NancyFx/most-valued-minions .. who's going to tag this against the milestone and push the magic button? ;) |
I think @damianh has got his finger on the trigger |
I am primed. |
We need to roll this back, merge was bad, I didn't approve... Clearly this isn't a team effort... |
👯 🍸 |
I think it's time we address this and start a discussion on how to structure/package things moving forward, and what better way to do that than with a pull request? 😉
This PR renames
NancyOwinHost
toNancyMiddleware
and moves it to the core project, (still) under theNancy.Owin
namespace.The
AppBuilderExtensions
are left intact in theNancy.Owin
project. API-wise, this is not even a breaking change 👍I also added extensions for the
Action<Func<AppFunc, AppFunc>>
approach for adding middleware, used in the newIBuilder.UseOwin
extensions. This means that you can now doin ASP.NET vNext, without other dependencies than core Nancy 👯
Fixes #1387