Большой рефактор

This commit is contained in:
2025-04-26 16:56:29 +04:00
parent 9d0683a23f
commit 76167f1b24
83 changed files with 943 additions and 864 deletions
+3 -2
View File
@@ -12,13 +12,13 @@ namespace Pf2eModel.Model.Base;
public class Entity
{
[System.ComponentModel.DataAnnotations.Key]
[Key]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
[Comment("Отображаемое имя")]
public LocaleString Name { get; set; } = new();
public LocaleString Name { get; set; } = [];
[Column(Order = 3)]
[Comment("Тип объекта")]
@@ -36,6 +36,7 @@ public class Entity
[Column(Order = 6)]
[Comment("Текстовое описание объекта")]
// ReSharper disable once EntityFramework.ModelValidation.UnlimitedStringLength
public string Description { get; set; } = null!;
[Column(Order = 7)]
+8 -3
View File
@@ -1,9 +1,10 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pf2eModel.Model.Common.I18n;
namespace Pf2eModel.Model.Base.Keywords;
public partial class Keyword
public class Keyword
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -11,10 +12,14 @@ public partial class Keyword
public int Id { get; set; }
[Column(Order = 2)]
public LocaleString Name = [];
[Column(Order = 3)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Slug { get; set; } = null!;
[Newtonsoft.Json.JsonIgnore]
public virtual ICollection<Entity> Entities { get; set; } = [];
public ICollection<Entity> Entities { get; set; } = [];
public virtual ICollection<KeywordAlias> Aliases { get; set; } = [];
public ICollection<KeywordAlias> Aliases { get; set; } = [];
}
@@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Base.Keywords;
public partial class KeywordAlias
public class KeywordAlias
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -18,5 +18,5 @@ public partial class KeywordAlias
public string Value { get; set; } = null!;
[Newtonsoft.Json.JsonIgnore]
public virtual Keyword Keyword { get; set; } = null!;
public Keyword Keyword { get; set; } = null!;
}
+3 -3
View File
@@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
namespace Pf2eModel.Model.Base.Source;
[PrimaryKey(nameof(EntityId), nameof(SourceId))]
public partial class EntitySource
public class EntitySource
{
[Column(Order = 1)]
public int EntityId { get; set; }
@@ -23,7 +23,7 @@ public partial class EntitySource
public bool IsRemaster { get; set; }
[Newtonsoft.Json.JsonIgnore]
public virtual Entity Entity { get; set; } = null!;
public Entity Entity { get; set; } = null!;
public virtual Source Source { get; set; } = null!;
public Source Source { get; set; } = null!;
}
+1 -1
View File
@@ -4,7 +4,7 @@ using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Base.Source;
public partial class Source
public class Source
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
namespace Pf2eModel.Model.Base.Targets;
[PrimaryKey(nameof(EntityId), nameof(TargetId))]
public partial class EntityExternal
public class EntityExternal
{
[Column(Order = 0)]
public int EntityId { get; set; }
@@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Base.Targets;
public partial class ExternalTarget
public class ExternalTarget
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -24,5 +24,5 @@ public partial class ExternalTarget
[Column(Order = 4)]
[Newtonsoft.Json.JsonIgnore]
public virtual ICollection<EntityExternal> EntityExternals { get; set; } = [];
public ICollection<EntityExternal> EntityExternals { get; set; } = [];
}