Большая пачка изменений

This commit is contained in:
2025-04-17 17:11:46 +04:00
parent 2ed5c2e5c5
commit a0eb739363
40 changed files with 990 additions and 6800 deletions
@@ -0,0 +1,33 @@
using Pf2eDataScrapper.Model;
using Slugify;
namespace Pf2eDataScrapper.Importers;
public class DatabaseHelper
{
public Pf2eDbContext Context = new();
public SlugHelper Slugger = new();
private int _id = 0;
public int NextEntityId { get => ++_id; set => _id = value; }
private DatabaseHelper()
{
NextEntityId = Context.Entities.Any() ? Context.Entities.Max(e => e.Id) : 0;
}
public string GenerateSlug(string name)
{
return Slugger.GenerateSlug(name);
}
public static readonly DatabaseHelper Instance = new();
public static readonly Pf2eDbContext DbContext = Instance.Context;
}