Adding back middleware initialization with options instance.

This commit is contained in:
John Luo 2015-12-23 15:09:59 -08:00
parent d9fc399531
commit c1589ef9bc
1 changed files with 23 additions and 0 deletions

View File

@ -37,5 +37,28 @@ namespace Microsoft.AspNet.Builder
return app.UseMiddleware<RequestLocalizationMiddleware>(options);
}
/// <summary>
/// Adds the <see cref="RequestLocalizationMiddleware"/> to automatically set culture information for
/// requests based on information provided by the client.
/// </summary>
/// <param name="app">The <see cref="IApplicationBuilder"/>.</param>
/// <param name="options">The <see cref="RequestLocalizationOptions"/> to configure the middleware with.</param>
/// <returns>The <see cref="IApplicationBuilder"/>.</returns>
public static IApplicationBuilder UseRequestLocalization(
this IApplicationBuilder app,
RequestLocalizationOptions options)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
return app.UseMiddleware<RequestLocalizationMiddleware>(options);
}
}
}