Added reload button and animation

This commit is contained in:
2025-01-16 11:24:16 +01:00
parent 1cf2b44503
commit fc85425189
9 changed files with 110 additions and 79 deletions

View File

@@ -4,14 +4,15 @@ using Microsoft.EntityFrameworkCore;
namespace HopFrame.Core.Config;
public class HopFrameConfig {
public List<DbContextConfig> Contexts { get; init; } = new();
public List<DbContextConfig> Contexts { get; } = new();
public bool DisplayUserInfo { get; set; } = true;
public Type? AuthHandler { get; set; }
public string? BasePolicy { get; set; }
public string? LoginPageRewrite { get; set; }
}
public class HopFrameConfigurator(HopFrameConfig config) {
public HopFrameConfig InnerConfig { get; } = config;
public HopFrameConfigurator AddDbContext<TDbContext>(Action<DbContextConfig<TDbContext>> configurator) where TDbContext : DbContext {
var context = AddDbContext<TDbContext>();
configurator.Invoke(context);
@@ -19,28 +20,23 @@ public class HopFrameConfigurator(HopFrameConfig config) {
}
public DbContextConfig<TDbContext> AddDbContext<TDbContext>() where TDbContext : DbContext {
var context = new DbContextConfig<TDbContext>(typeof(TDbContext));
config.Contexts.Add(context);
return context;
var context = new DbContextConfig(typeof(TDbContext));
InnerConfig.Contexts.Add(context);
return new DbContextConfig<TDbContext>(context);
}
public HopFrameConfigurator DisplayUserInfo(bool display) {
config.DisplayUserInfo = display;
return this;
}
public HopFrameConfigurator SetAuthHandler<TAuthHandler>() where TAuthHandler : IHopFrameAuthHandler {
config.AuthHandler = typeof(TAuthHandler);
InnerConfig.DisplayUserInfo = display;
return this;
}
public HopFrameConfigurator SetBasePolicy(string basePolicy) {
config.BasePolicy = basePolicy;
InnerConfig.BasePolicy = basePolicy;
return this;
}
public HopFrameConfigurator SetLoginPage(string url) {
config.LoginPageRewrite = url;
InnerConfig.LoginPageRewrite = url;
return this;
}
}