[Identity] Disable polling on file providers (#11048)
* Disable polling on file file providers. * Use in-memory SQL lite database always on the test project.
This commit is contained in:
parent
85feca7a12
commit
c7a9da58b4
|
|
@ -42,6 +42,8 @@ namespace Identity.DefaultUI.WebSite
|
|||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
StartupBase<IdentityUser,IdentityDbContext>.DisableFilePolling(env);
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
|
|
|||
|
|
@ -42,10 +42,11 @@ namespace Identity.DefaultUI.WebSite
|
|||
services.AddDbContext<TContext>(options =>
|
||||
options
|
||||
.ConfigureWarnings(b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning))
|
||||
.UseSqlServer(
|
||||
Configuration.GetConnectionString("DefaultConnection"),
|
||||
sqlOptions => sqlOptions.MigrationsAssembly("Identity.DefaultUI.WebSite")
|
||||
));
|
||||
//.UseSqlServer(
|
||||
// Configuration.GetConnectionString("DefaultConnection"),
|
||||
// sqlOptions => sqlOptions.MigrationsAssembly("Identity.DefaultUI.WebSite")
|
||||
//));
|
||||
.UseSqlite("DataSource=:memory:"));
|
||||
|
||||
services.AddDefaultIdentity<TUser>()
|
||||
.AddDefaultUI(Framework)
|
||||
|
|
@ -89,10 +90,11 @@ namespace Identity.DefaultUI.WebSite
|
|||
});
|
||||
}
|
||||
|
||||
protected static void DisableFilePolling(IWebHostEnvironment env)
|
||||
public static void DisableFilePolling(IWebHostEnvironment env)
|
||||
{
|
||||
var pendingProviders = new Stack<IFileProvider>();
|
||||
pendingProviders.Push(env.WebRootFileProvider);
|
||||
pendingProviders.Push(env.ContentRootFileProvider);
|
||||
while (pendingProviders.TryPop(out var currentProvider))
|
||||
{
|
||||
switch (currentProvider)
|
||||
|
|
|
|||
Loading…
Reference in New Issue