Sample ASP.NET Core 3.0 web project which extracts from identity Razor pages all references to Microsoft.AspNetCore.Identity and move the code in some MediatR handlers.
For more details see https://ovi.crisan.ca/2019/03/aspnet-core-identity-with-mediatr.html.
Relevant code is in Areas/Identity/MediatR folder, as well as updated Startup.cs and Login.cshtml.cs and Logout.cshtml.cs from this folder.