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

Don't allocate the FormFeature eagerly per request #880

Closed
davidfowl opened this issue Jun 29, 2017 · 3 comments
Closed

Don't allocate the FormFeature eagerly per request #880

davidfowl opened this issue Jun 29, 2017 · 3 comments

Comments

@davidfowl
Copy link
Member

davidfowl commented Jun 29, 2017

Today, in order to pass the form options to the FormFeature, we eagerly allocate it here

var formFeature = new FormFeature(httpContext.Request, _formOptions);
. We should find a creative way to avoid doing this so eagerly in the common cases. Here are some options:

  • Invent a new way to pass things to features lazily (hard, we tried this and ended up with crazy things)
  • Only new up the FormOptions if they were overridden. We'd need a way to detect if the FormOptions were actually set. This is doable but could get ugly as there's no way to detect if options were configured. /cc @HaoK
  • Only set the FormFeature if the request is a POST and HasFormContentType. Gross, but would be more pay for play than what we have today.

/cc @vancem @Tratcher

@HaoK
Copy link
Member

HaoK commented Jun 29, 2017

We could add a new bool property to IOptionsFactory<TOptions> like IsConfigured, so you could then avoid calling IOptions.Value in this case.

@muratg
Copy link

muratg commented Oct 30, 2017

@davidfowl Backlogging this until we find a good design to prototype.

@aspnet-hello
Copy link

This issue was moved to dotnet/aspnetcore#2699

@aspnet aspnet locked and limited conversation to collaborators Jan 2, 2018
@aspnet-hello aspnet-hello removed this from the Backlog milestone Jan 2, 2018
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

4 participants