Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​AspNetCore.​Builder.​UseExtensions
Assembly: Microsoft.AspNetCore.Http.Abstractions
Inheritance: object → UseExtensions
Extension methods for adding middleware.
Methods
public static
IApplicationBuilder
Use​(IApplicationBuilder app,
System.​Func<​Http.​HttpContext, System.​Func<​System.​Threading.​Tasks.​Task>, System.​Threading.​Tasks.​Task> middleware)
Adds a middleware delegate defined in-line to the application's request pipeline.
If you aren't calling the next function, use <see cref="M:Microsoft.AspNetCore.Builder.RunExtensions.Run(Microsoft.AspNetCore.Builder.IApplicationBuilder,Microsoft.AspNetCore.Http.RequestDelegate)" /> instead.
<para>
Prefer using <see cref="M:Microsoft.AspNetCore.Builder.UseExtensions.Use(Microsoft.AspNetCore.Builder.IApplicationBuilder,System.Func{Microsoft.AspNetCore.Http.HttpContext,Microsoft.AspNetCore.Http.RequestDelegate,System.Threading.Tasks.Task})" /> for better performance as shown below:
<code>
app.Use((context, next) =>
{
return next(context);
});
</code></para>
Returns The <see cref="T:Microsoft.AspNetCore.Builder.IApplicationBuilder" /> instance.
app
The <see cref="T:Microsoft.AspNetCore.Builder.IApplicationBuilder" /> instance.
middleware
A function that handles the request and calls the given next function.
public static
IApplicationBuilder
Use​(IApplicationBuilder app,
System.​Func<​Http.​HttpContext, Http.​RequestDelegate, System.​Threading.​Tasks.​Task> middleware)
Adds a middleware delegate defined in-line to the application's request pipeline.
If you aren't calling the next function, use <see cref="M:Microsoft.AspNetCore.Builder.RunExtensions.Run(Microsoft.AspNetCore.Builder.IApplicationBuilder,Microsoft.AspNetCore.Http.RequestDelegate)" /> instead.
Returns The <see cref="T:Microsoft.AspNetCore.Builder.IApplicationBuilder" /> instance.
app
The <see cref="T:Microsoft.AspNetCore.Builder.IApplicationBuilder" /> instance.
middleware
A function that handles the request and calls the given next function.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object