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

IFeatureCollection indexer is pretty bad #414

Closed
lodejard opened this issue Sep 23, 2015 · 9 comments
Closed

IFeatureCollection indexer is pretty bad #414

lodejard opened this issue Sep 23, 2015 · 9 comments

Comments

@lodejard
Copy link
Contributor

This usage is pretty awful:

var feature = httpContext.Features[typeof(IServiceProvidersFeature)] as IServiceProvidersFeature;

It doesn't show up in intellisense, and GetFeature/SetFeature don't appear on HttpContext...

Didn't we have something more like this at one point?

var feature = yadda.GetFeature<IServiceProvidersFeature>();
@Tratcher
Copy link
Member

It moved to httpContext.Features.Get<T>();

@lodejard
Copy link
Contributor Author

Oh, the namespace using Microsoft.AspNet.Http.Features; means it pretty much won't show up if you don't already know it exists. Is there anything we can do about that?

@Tratcher
Copy link
Member

All the interfaces are also on that namespace, so you need to add it anyways. Would be nice if we could make the first time intellesence work better though.

VS feature? Consider the namespace of the thing currently being operated on?

@davidfowl
Copy link
Member

We can't rely on VS features. We should move things around

@Tratcher
Copy link
Member

Just keep in mind that Features are for advanced scenarios like middleware authoring, don't munge them in with all the beginners stuff.

@HaoK
Copy link
Member

HaoK commented Sep 23, 2015

Just a +1, I was looking for these methods, and it was hard to find them even looking for them :)

I ended up needing all 3 namespaces for the IServiceProviders change:

using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http.Features.Internal;

@davidfowl
Copy link
Member

Ugh

@muratg
Copy link

muratg commented Oct 14, 2015

Collapsing namespaces is also a solution.

@Tratcher
Copy link
Member

Tratcher commented Jan 4, 2016

Resolved by #522

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants