I have an extension method using Action
in ASP.NET Core 3.1:
public static IApplicationBuilder UseSitemap(this IApplicationBuilder builder, Action<(String BaseUrl, String Route)> options) {
(String BaseUrl, String Route) sitemapOptions = ("", "/sitemap"); // Default values
options?.Invoke(sitemapOptions);
return builder.MapWhen(x => x.Request.Path.StartsWithSegments(sitemapOptions.Route), x => x.UseMiddleware<SitemapMiddleware>(sitemapOptions));
}
Then I use it as follows:
application.UseSitemap(x => {
x.BaseUrl = "https://locahost:80";
x.Route = "/sitemap.xml";
});
However, sitemapOptions is not getting the new values. Why?