Обработка через CSharper

This commit is contained in:
2025-04-24 18:10:05 +04:00
parent cc7e97b6ff
commit 7dcf582c3e
89 changed files with 377 additions and 324 deletions
+5 -3
View File
@@ -1,7 +1,7 @@
using Pf2eModel.Model;
using System.Reflection;
using Pf2eModel.Model;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using System.Reflection;
namespace Pf2eModel;
@@ -21,7 +21,9 @@ public class EntityOfTypeAttribute(EntityType type) : Attribute
if (!type.IsAssignableTo(typeof(IEntity)))
{
throw new Exception($"'EntityOfTypeAttribute' attribute should only be applied to children of 'IEntity' class. '{type.FullName}' is not.");
throw new Exception(
$"'EntityOfTypeAttribute' attribute should only be applied to children of 'IEntity' class. '{type.FullName}' is not."
);
}
EntityOfTypeAttribute attribute = type.GetCustomAttribute<EntityOfTypeAttribute>()!;
+3 -3
View File
@@ -1,12 +1,12 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Pf2eModel.Model.Base.Keywords;
using Pf2eModel.Model.Base.Source;
using Pf2eModel.Model.Base.Targets;
using Pf2eModel.Model.Common.I18n;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Base;
-1
View File
@@ -17,5 +17,4 @@ public partial class Keyword
public virtual ICollection<Entity> Entities { get; set; } = [];
public virtual ICollection<KeywordAlias> Aliases { get; set; } = [];
}
+2 -2
View File
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Pf2eModel.Model.Base.Source;
+2 -3
View File
@@ -1,6 +1,6 @@
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Base.Source;
@@ -21,7 +21,6 @@ public partial class Source
[Column(Order = 4)]
public DateOnly? ReleaseDate { get; set; }
[Newtonsoft.Json.JsonIgnore]
public ICollection<EntitySource> EntitySources { get; set; } = [];
}
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Pf2eModel.Model.Base.Targets;
+2 -1
View File
@@ -6,5 +6,6 @@ public class LocaleItem(LocaleType type, string value)
public string Value { get; set; } = value;
public LocaleItem(KeyValuePair<string, string> item) : this(LocaleExtension.GetTypeByString(item.Key), item.Value) { }
public LocaleItem(KeyValuePair<string, string> item)
: this(LocaleExtension.GetTypeByString(item.Key), item.Value) { }
}
+2 -2
View File
@@ -1,6 +1,6 @@
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Common;
+1 -5
View File
@@ -15,10 +15,6 @@ public enum ActionCategory
[PgName("class-feat")]
ClassFeat,
[PgName("offensive")]
Offensive,
@@ -45,4 +41,4 @@ public enum ActionCategory
[PgName("kingdom_feature")]
KingdomFeature,
}
}
+1 -1
View File
@@ -12,4 +12,4 @@ public enum AncestryVision
[PgName("dark-vision")]
DarkVision,
}
}
+1 -1
View File
@@ -23,5 +23,5 @@ public enum AttributeValues
Wisdom,
[PgName("cha")]
Charisma
Charisma,
}
+2 -3
View File
@@ -2,7 +2,6 @@
namespace Pf2eModel.Model.Enum;
public enum ConditionGroup
{
[PgName("unknown")]
@@ -21,5 +20,5 @@ public enum ConditionGroup
Attitudes,
[PgName("detection")]
Detection
}
Detection,
}
+1 -1
View File
@@ -12,4 +12,4 @@ public enum DeitySanctification
[PgName("any")]
Any,
}
}
+1 -1
View File
@@ -14,5 +14,5 @@ public enum EntityRarity
Rare,
[PgName("unique")]
Unique
Unique,
}
+2 -2
View File
@@ -47,5 +47,5 @@ public enum EntityType
Spell,
[PgName("language")]
Language
}
Language,
}
+1 -1
View File
@@ -42,4 +42,4 @@ public enum FeatCategory
[PgName("campaign-feature")]
CampaignFeature,
}
}
+1 -1
View File
@@ -15,4 +15,4 @@ public enum Size
[PgName("large")]
Large,
}
}
+1
View File
@@ -1,6 +1,7 @@
using NpgsqlTypes;
namespace Pf2eModel.Model.Enum;
public enum SourceCategory
{
[PgName("rulebook")]
+1 -1
View File
@@ -24,4 +24,4 @@ public enum SpellAreaType
[PgName("cylinder")]
Cylinder,
}
}
+1 -1
View File
@@ -9,4 +9,4 @@ public enum SpellDamageCategory
[PgName("splash")]
Splash,
}
}
+1 -1
View File
@@ -12,4 +12,4 @@ public enum SpellDamageKinds
[PgName("any")]
Any,
}
}
+1 -1
View File
@@ -21,4 +21,4 @@ public enum SpellTradition
[PgName("all")]
All,
}
}
+1
View File
@@ -1,4 +1,5 @@
namespace Pf2eModel.Model.Enum;
public enum TrainingStage
{
Untrained = 0,
+1
View File
@@ -1,6 +1,7 @@
using NpgsqlTypes;
namespace Pf2eModel.Model.Enum;
public enum TrainingType
{
[PgName("perception")]
+1 -1
View File
@@ -11,5 +11,5 @@ public enum TraitType
Class,
[PgName("tradition")]
Tradition
Tradition,
}
-1
View File
@@ -9,5 +9,4 @@ public interface IEntity
[JsonIgnore]
public Entity Entity { get; set; }
}
+2 -3
View File
@@ -1,6 +1,6 @@
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure;
@@ -30,6 +30,5 @@ public partial class Action : IEntity
[Column(Order = 6)]
public string? Extra { get; set; }
public Entity Entity { get; set; } = null!;
}
+2 -2
View File
@@ -1,7 +1,7 @@
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure.AncestryRelation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure;
@@ -1,6 +1,6 @@
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace Pf2eModel.Model.Structure.AncestryRelation;
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure.AncestryRelation;
@@ -1,5 +1,5 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Pf2eModel.Model.Structure.AncestryRelation;
+3 -3
View File
@@ -1,8 +1,8 @@
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure.BackgroundRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure;
@@ -1,7 +1,7 @@
using Newtonsoft.Json;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Structure.BackgroundRelation;
@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure.BackgroundRelation;
@@ -1,8 +1,8 @@
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Pf2eModel.Model.Common;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure.BackgroundRelation;
+3 -3
View File
@@ -1,8 +1,8 @@
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure.ClassRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure;
@@ -1,7 +1,7 @@
using Newtonsoft.Json;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Structure.ClassRelation;
@@ -1,10 +1,11 @@
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure.ClassRelation;
public partial class ClassProgression
{
[Key]
@@ -1,8 +1,8 @@
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Pf2eModel.Model.Common;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure.ClassRelation;
+3 -3
View File
@@ -1,7 +1,7 @@
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Structure;
+5 -4
View File
@@ -1,9 +1,9 @@
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Common;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure.DeityRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure;
@@ -29,7 +29,8 @@ public partial class Deity : IEntity
[Column(Order = 5)]
public bool SanctificationMust { get; set; }
public virtual ICollection<DeityAttribute> DeityAttributes { get; set; } = new List<DeityAttribute>();
public virtual ICollection<DeityAttribute> DeityAttributes { get; set; } =
new List<DeityAttribute>();
public virtual ICollection<DeityDomain> DeityDomains { get; set; } = new List<DeityDomain>();
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure.DeityRelation;
+3 -4
View File
@@ -1,8 +1,8 @@
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure.FeatRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure;
@@ -37,7 +37,6 @@ public partial class Feat : IEntity
[Column(Order = 9)]
public bool IsPassive { get; set; } = false;
[Column(Order = 10)]
public string? Extra { get; set; }
+3 -3
View File
@@ -1,7 +1,7 @@
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Structure;
+3 -3
View File
@@ -1,8 +1,8 @@
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure.SpellRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure;
@@ -1,6 +1,6 @@
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Structure.SpellRelation;
@@ -1,6 +1,6 @@
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Structure.SpellRelation;
+3 -3
View File
@@ -1,7 +1,7 @@
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Structure;
+5 -10
View File
@@ -20,14 +20,10 @@ namespace Pf2eModel;
public partial class Pf2eDbContext : DbContext
{
public Pf2eDbContext()
{
}
public Pf2eDbContext() { }
public Pf2eDbContext(DbContextOptions<Pf2eDbContext> options)
: base(options)
{
}
: base(options) { }
#region DbSets
@@ -118,7 +114,8 @@ public partial class Pf2eDbContext : DbContext
// optionsBuilder.LogTo(Console.WriteLine);
optionsBuilder.UseSnakeCaseNamingConvention();
optionsBuilder.UseNpgsql(databaseCnnection,
optionsBuilder.UseNpgsql(
databaseCnnection,
builder =>
{
builder
@@ -141,10 +138,8 @@ public partial class Pf2eDbContext : DbContext
.MapEnum<SpellDamageKinds>()
.MapEnum<AttributeValues>()
.MapEnum<TrainingStage>()
.MapEnum<SourceCategory>()
;
.MapEnum<SourceCategory>();
}
);
}
}
+16 -23
View File
@@ -1,43 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>True</GenerateRuntimeConfigurationFiles>
<GenerateRuntimeConfigurationFiles>True</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
<ItemGroup>
<None Include="..\Pf2eDataScrapper\.env" Link=".env">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\Pf2eDataScrapper\.env" Link=".env">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="dotenv.net" Version="3.2.1" />
<PackageReference Include="EFCore.NamingConventions" Version="9.0.0" />
<PackageReference Include="linq2db" Version="5.4.1" />
<PackageReference Include="linq2db.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.4">
<!--<PrivateAssets>all</PrivateAssets>-->
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Npgsql" Version="9.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
<PackageReference Include="dotenv.net" Version="3.2.1" />
<PackageReference Include="EFCore.NamingConventions" Version="9.0.0" />
<PackageReference Include="linq2db" Version="5.4.1" />
<PackageReference Include="linq2db.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.4">
<!--<PrivateAssets>all</PrivateAssets>-->
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Npgsql" Version="9.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
</ItemGroup>
<ItemGroup>
<None Update="RebuildDatabase.bat">
<Generator></Generator>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>
<ItemGroup>
<Compile Update="RebuildDatabase.cs">
<DesignTime>True</DesignTime>
@@ -45,5 +39,4 @@
<DependentUpon>RebuildDatabase.bat</DependentUpon>
</Compile>
</ItemGroup>
</Project>