Большая пачка изменений
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user