Added reload button and animation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user