improve migration history
This commit is contained in:
@ -69,7 +69,6 @@ namespace Oqtane.Repository
|
||||
public virtual DbSet<JobLog> JobLog { get; set; }
|
||||
public virtual DbSet<Setting> Setting { get; set; }
|
||||
public virtual DbSet<Theme> Theme { get; set; }
|
||||
public virtual DbSet<MigrationHistory> MigrationHistory { get; set; }
|
||||
|
||||
public override int SaveChanges()
|
||||
{
|
||||
|
||||
@ -33,5 +33,6 @@ namespace Oqtane.Repository
|
||||
public virtual DbSet<SearchContentProperty> SearchContentProperty { get; set; }
|
||||
public virtual DbSet<SearchContentWord> SearchContentWord { get; set; }
|
||||
public virtual DbSet<SearchWord> SearchWord { get; set; }
|
||||
public virtual DbSet<MigrationHistory> MigrationHistory { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
@ -10,16 +11,17 @@ namespace Oqtane.Repository
|
||||
}
|
||||
public class MigrationHistoryRepository : IMigrationHistoryRepository
|
||||
{
|
||||
private MasterDBContext _db;
|
||||
private readonly IDbContextFactory<TenantDBContext> _dbContextFactory;
|
||||
|
||||
public MigrationHistoryRepository(MasterDBContext context)
|
||||
public MigrationHistoryRepository(IDbContextFactory<TenantDBContext> dbContextFactory)
|
||||
{
|
||||
_db = context;
|
||||
_dbContextFactory = dbContextFactory;
|
||||
}
|
||||
|
||||
public IEnumerable<MigrationHistory> GetMigrationHistory()
|
||||
{
|
||||
return _db.MigrationHistory.ToList();
|
||||
using var db = _dbContextFactory.CreateDbContext();
|
||||
return db.MigrationHistory.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user