Cleaned up the startup sequence.
This commit is contained in:
17
Moonlight.ApiServer/Helpers/DatabaseContextCollection.cs
Normal file
17
Moonlight.ApiServer/Helpers/DatabaseContextCollection.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
|
||||
namespace Moonlight.ApiServer.Helpers;
|
||||
|
||||
public class DatabaseContextCollection : IEnumerable<Type>
|
||||
{
|
||||
private readonly List<Type> Types = new();
|
||||
|
||||
public IEnumerator<Type> GetEnumerator() => Types.GetEnumerator();
|
||||
IEnumerator IEnumerable.GetEnumerator() => Types.GetEnumerator();
|
||||
|
||||
public void Add<T>() where T : DatabaseContext
|
||||
=> Types.Add(typeof(T));
|
||||
|
||||
public void Remove(Type type) => Types.Remove(type);
|
||||
public void Remove<T>() where T : DatabaseContext => Remove(typeof(T));
|
||||
}
|
||||
Reference in New Issue
Block a user