[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.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
|
StartupBase<IdentityUser,IdentityDbContext>.DisableFilePolling(env);
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,11 @@ namespace Identity.DefaultUI.WebSite
|
||||||
services.AddDbContext<TContext>(options =>
|
services.AddDbContext<TContext>(options =>
|
||||||
options
|
options
|
||||||
.ConfigureWarnings(b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning))
|
.ConfigureWarnings(b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning))
|
||||||
.UseSqlServer(
|
//.UseSqlServer(
|
||||||
Configuration.GetConnectionString("DefaultConnection"),
|
// Configuration.GetConnectionString("DefaultConnection"),
|
||||||
sqlOptions => sqlOptions.MigrationsAssembly("Identity.DefaultUI.WebSite")
|
// sqlOptions => sqlOptions.MigrationsAssembly("Identity.DefaultUI.WebSite")
|
||||||
));
|
//));
|
||||||
|
.UseSqlite("DataSource=:memory:"));
|
||||||
|
|
||||||
services.AddDefaultIdentity<TUser>()
|
services.AddDefaultIdentity<TUser>()
|
||||||
.AddDefaultUI(Framework)
|
.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>();
|
var pendingProviders = new Stack<IFileProvider>();
|
||||||
pendingProviders.Push(env.WebRootFileProvider);
|
pendingProviders.Push(env.WebRootFileProvider);
|
||||||
|
pendingProviders.Push(env.ContentRootFileProvider);
|
||||||
while (pendingProviders.TryPop(out var currentProvider))
|
while (pendingProviders.TryPop(out var currentProvider))
|
||||||
{
|
{
|
||||||
switch (currentProvider)
|
switch (currentProvider)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue