mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 00:18:39 +00:00
Implement property dependency injection for the website (#806)
* Remove most non DI usages of DbContext * Optimize website queries and refactor startup to use top level statements * Remove unused functions in UserEntity and SlotEntity * Optimize LBP1 LevelTags
This commit is contained in:
parent
727dd4e903
commit
e43397ac6a
47 changed files with 333 additions and 430 deletions
|
@ -1,23 +0,0 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Xunit;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Tests.Integration;
|
||||
|
||||
public sealed class DatabaseFactAttribute : FactAttribute
|
||||
{
|
||||
private static readonly object migrateLock = new();
|
||||
|
||||
public DatabaseFactAttribute()
|
||||
{
|
||||
ServerConfiguration.Instance.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
||||
if (!ServerStatics.DbConnected) this.Skip = "Database not available";
|
||||
else
|
||||
lock (migrateLock)
|
||||
{
|
||||
using DatabaseContext database = DatabaseContext.CreateNewInstance();
|
||||
database.Database.Migrate();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue