I am developing a plugin and I need to inject another middleware into the user StartUp.cs, is there a way to it without modifying the user StartUp.cs?
The only way I can think of is actually patching the runtime and inject the required IL instructions to the start of UseXaf middleware that call my middleware first. However I am hoping there is build-in mechanism to it.
if(env.IsDevelopment()) {
app.UseDeveloperExceptionPage();
}
else {
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
//INJECT IT HERE <---------
app.UseXaf();