151 lines
4.8 KiB
C#
151 lines
4.8 KiB
C#
using dotenv.net;
|
|
using dotenv.net.Utilities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Pf2eModel.Model.Base;
|
|
using Pf2eModel.Model.Base.Keywords;
|
|
using Pf2eModel.Model.Base.Source;
|
|
using Pf2eModel.Model.Base.Targets;
|
|
using Pf2eModel.Model.Common;
|
|
using Pf2eModel.Model.Enum;
|
|
using Pf2eModel.Model.Structure;
|
|
using Pf2eModel.Model.Structure.AncestryRelation;
|
|
using Pf2eModel.Model.Structure.BackgroundRelation;
|
|
using Pf2eModel.Model.Structure.ClassRelation;
|
|
using Pf2eModel.Model.Structure.DeityRelation;
|
|
using Pf2eModel.Model.Structure.FeatRelation;
|
|
using Pf2eModel.Model.Structure.SpellRelation;
|
|
|
|
namespace Pf2eModel.Model;
|
|
|
|
public partial class Pf2eDbContext : DbContext
|
|
{
|
|
public Pf2eDbContext()
|
|
{
|
|
}
|
|
|
|
public Pf2eDbContext(DbContextOptions<Pf2eDbContext> options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
#region DbSets
|
|
|
|
public virtual DbSet<Structure.Action> Actions { get; set; }
|
|
|
|
public virtual DbSet<Ancestry> Ancestries { get; set; }
|
|
|
|
public virtual DbSet<AncestryBoost> AncestryBoosts { get; set; }
|
|
|
|
public virtual DbSet<AncestryItem> AncestryItems { get; set; }
|
|
|
|
public virtual DbSet<AncestryLanguage> AncestryLanguages { get; set; }
|
|
|
|
public virtual DbSet<Background> Backgrounds { get; set; }
|
|
|
|
public virtual DbSet<BackgroundBoost> BackgroundBoosts { get; set; }
|
|
|
|
public virtual DbSet<BackgroundItem> BackgroundItems { get; set; }
|
|
|
|
public virtual DbSet<BackgroundTraining> BackgroundSkills { get; set; }
|
|
|
|
public virtual DbSet<Class> Classes { get; set; }
|
|
|
|
public virtual DbSet<ClassKeyAbility> ClassKeyAbilities { get; set; }
|
|
|
|
public virtual DbSet<ClassProgression> ClassProgressions { get; set; }
|
|
|
|
public virtual DbSet<ClassTraining> ClassTrainings { get; set; }
|
|
|
|
public virtual DbSet<Condition> Conditions { get; set; }
|
|
|
|
public virtual DbSet<Deity> Deities { get; set; }
|
|
|
|
public virtual DbSet<DeityAttribute> DeityAttributes { get; set; }
|
|
|
|
public virtual DbSet<DeityDomain> DeityDomains { get; set; }
|
|
|
|
public virtual DbSet<DeitySpell> DeitySpells { get; set; }
|
|
|
|
public virtual DbSet<DeityWeapon> DeityWeapons { get; set; }
|
|
|
|
public virtual DbSet<Entity> Entities { get; set; }
|
|
|
|
public virtual DbSet<EntityAlias> EntityAliases { get; set; }
|
|
|
|
public virtual DbSet<EntityExternal> EntityExternals { get; set; }
|
|
|
|
public virtual DbSet<EntitySource> EntitySources { get; set; }
|
|
|
|
public virtual DbSet<ExternalTarget> ExternalTargets { get; set; }
|
|
|
|
public virtual DbSet<Feat> Feats { get; set; }
|
|
|
|
public virtual DbSet<FeatPrerequisite> FeatPrerequisites { get; set; }
|
|
|
|
public virtual DbSet<Frequency> Frequencies { get; set; }
|
|
|
|
public virtual DbSet<Heritage> Heritages { get; set; }
|
|
|
|
public virtual DbSet<Keyword> Keywords { get; set; }
|
|
|
|
public virtual DbSet<KeywordAlias> KeywordAliases { get; set; }
|
|
|
|
public virtual DbSet<Language> Languages { get; set; }
|
|
|
|
public virtual DbSet<Source> Sources { get; set; }
|
|
|
|
public virtual DbSet<Spell> Spells { get; set; }
|
|
|
|
public virtual DbSet<SpellArea> SpellAreas { get; set; }
|
|
|
|
public virtual DbSet<SpellDamage> SpellDamages { get; set; }
|
|
|
|
public virtual DbSet<SpellDefense> SpellDefenses { get; set; }
|
|
|
|
public virtual DbSet<SpellRitual> SpellRituals { get; set; }
|
|
|
|
public virtual DbSet<Training> Trainings { get; set; }
|
|
|
|
public virtual DbSet<Trait> Traits { get; set; }
|
|
|
|
#endregion
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
DotEnv.Load(options: new DotEnvOptions(probeForEnv: true, probeLevelsToSearch: 2));
|
|
string databaseCnnection = EnvReader.GetStringValue("DATABASE_CONNECTION");
|
|
|
|
// optionsBuilder.LogTo(Console.WriteLine);
|
|
optionsBuilder.UseSnakeCaseNamingConvention();
|
|
optionsBuilder.UseNpgsql(databaseCnnection,
|
|
builder =>
|
|
{
|
|
builder
|
|
.MapEnum<EntityType>()
|
|
.MapEnum<EntityRarity>()
|
|
.MapEnum<AliasType>()
|
|
.MapEnum<TraitType>()
|
|
.MapEnum<ActionType>()
|
|
.MapEnum<ActionCategory>()
|
|
.MapEnum<Size>()
|
|
.MapEnum<AncestryVision>()
|
|
.MapEnum<ClassProgressionType>()
|
|
.MapEnum<ConditionGroup>()
|
|
.MapEnum<DeityCategory>()
|
|
.MapEnum<DeityFonts>()
|
|
.MapEnum<DeitySanctification>()
|
|
.MapEnum<FeatActionType>()
|
|
.MapEnum<FeatCategory>()
|
|
.MapEnum<SpellAreaType>()
|
|
.MapEnum<SpellDamageCategory>()
|
|
.MapEnum<SpellDamageKinds>()
|
|
.MapEnum<AttributeValues>()
|
|
.MapEnum<TrainingStage>()
|
|
.MapEnum<SourceCategory>()
|
|
;
|
|
}
|
|
);
|
|
}
|
|
|
|
}
|