mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:02:55 +08:00
Don't make one factory each context
A factory is supposed to be re-used.
This commit is contained in:
parent
36c00577af
commit
b02dd196f6
@ -22,6 +22,8 @@ namespace osu.Game.Database
|
||||
public DbSet<RulesetInfo> RulesetInfo { get; set; }
|
||||
private readonly string connectionString;
|
||||
|
||||
private static readonly Lazy<OsuDbLoggerFactory> logger = new Lazy<OsuDbLoggerFactory>(() => new OsuDbLoggerFactory());
|
||||
|
||||
static OsuDbContext()
|
||||
{
|
||||
// required to initialise native SQLite libraries on some platforms.
|
||||
@ -60,7 +62,7 @@ namespace osu.Game.Database
|
||||
{
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
optionsBuilder.UseSqlite(connectionString);
|
||||
optionsBuilder.UseLoggerFactory(new OsuDbLoggerFactory());
|
||||
optionsBuilder.UseLoggerFactory(logger.Value);
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
|
Loading…
Reference in New Issue
Block a user