Обновленние-добавление

This commit is contained in:
ArhaNge1
2026-10-21 15:39:13 +03:00
parent efb41a5d8a
commit ebd04219c5
34 changed files with 35543 additions and 36 deletions
+16
View File
@@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokedexApp", "PokedexApp\PokedexApp.csproj", "{3A45169D-4715-4CAB-BF8D-6201F208BF24}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3A45169D-4715-4CAB-BF8D-6201F208BF24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A45169D-4715-4CAB-BF8D-6201F208BF24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A45169D-4715-4CAB-BF8D-6201F208BF24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A45169D-4715-4CAB-BF8D-6201F208BF24}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[Table("ability")]
[Index("AbilityName", Name = "ability_ability_name_key", IsUnique = true)]
public partial class Ability
{
[Key]
[Column("ability_id")]
public int AbilityId { get; set; }
[Column("ability_name")]
[StringLength(60)]
public string AbilityName { get; set; } = null!;
[Column("ability_description")]
public string? AbilityDescription { get; set; }
[Column("ability_is_hidden")]
public bool AbilityIsHidden { get; set; }
[InverseProperty("Ability")]
public virtual ICollection<PokemonAbility> PokemonAbilities { get; set; } = new List<PokemonAbility>();
}
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[Table("caught_pokemon")]
public partial class CaughtPokemon
{
[Key]
[Column("caught_pokemon_id")]
public int CaughtPokemonId { get; set; }
[Column("trainer_id")]
public int TrainerId { get; set; }
[Column("pokemon_id")]
public int PokemonId { get; set; }
[Column("caught_pokemon_nickname")]
[StringLength(50)]
public string? CaughtPokemonNickname { get; set; }
[Column("caught_pokemon_level")]
public short CaughtPokemonLevel { get; set; }
[Column("caught_pokemon_gender")]
[MaxLength(1)]
public char? CaughtPokemonGender { get; set; }
[Column("caught_pokemon_is_shiny")]
public bool CaughtPokemonIsShiny { get; set; }
[Column("caught_pokemon_catch_date")]
public DateOnly CaughtPokemonCatchDate { get; set; }
[Column("catch_region_id")]
public int? CatchRegionId { get; set; }
[ForeignKey("CatchRegionId")]
[InverseProperty("CaughtPokemons")]
public virtual Region? CatchRegion { get; set; }
[ForeignKey("PokemonId")]
[InverseProperty("CaughtPokemons")]
public virtual Pokemon Pokemon { get; set; } = null!;
[ForeignKey("TrainerId")]
[InverseProperty("CaughtPokemons")]
public virtual Trainer Trainer { get; set; } = null!;
}
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[Table("evolution")]
[Index("FromPokemonId", "ToPokemonId", Name = "uq_evolution_pair", IsUnique = true)]
public partial class Evolution
{
[Key]
[Column("evolution_id")]
public int EvolutionId { get; set; }
[Column("from_pokemon_id")]
public int FromPokemonId { get; set; }
[Column("to_pokemon_id")]
public int ToPokemonId { get; set; }
[Column("evolution_trigger")]
[StringLength(30)]
public string EvolutionTrigger { get; set; } = null!;
[Column("evolution_min_level")]
public short? EvolutionMinLevel { get; set; }
[Column("evolution_item_name")]
[StringLength(50)]
public string? EvolutionItemName { get; set; }
[ForeignKey("FromPokemonId")]
[InverseProperty("EvolutionFromPokemons")]
public virtual Pokemon FromPokemon { get; set; } = null!;
[ForeignKey("ToPokemonId")]
[InverseProperty("EvolutionToPokemons")]
public virtual Pokemon ToPokemon { get; set; } = null!;
}
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[Table("move")]
[Index("MoveName", Name = "move_move_name_key", IsUnique = true)]
public partial class Move
{
[Key]
[Column("move_id")]
public int MoveId { get; set; }
[Column("move_name")]
[StringLength(80)]
public string MoveName { get; set; } = null!;
[Column("type_id")]
public int TypeId { get; set; }
[Column("move_category")]
[StringLength(10)]
public string MoveCategory { get; set; } = null!;
[Column("move_power")]
public short? MovePower { get; set; }
[Column("move_accuracy")]
public short? MoveAccuracy { get; set; }
[Column("move_pp")]
public short MovePp { get; set; }
[Column("move_description")]
public string? MoveDescription { get; set; }
[InverseProperty("Move")]
public virtual ICollection<PokemonMove> PokemonMoves { get; set; } = new List<PokemonMove>();
[ForeignKey("TypeId")]
[InverseProperty("Moves")]
public virtual Type Type { get; set; } = null!;
}
@@ -0,0 +1,167 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
public partial class PokedexDbContext : DbContext
{
public PokedexDbContext()
{
}
public PokedexDbContext(DbContextOptions<PokedexDbContext> options)
: base(options)
{
}
public virtual DbSet<Ability> Abilities { get; set; }
public virtual DbSet<CaughtPokemon> CaughtPokemons { get; set; }
public virtual DbSet<Evolution> Evolutions { get; set; }
public virtual DbSet<Move> Moves { get; set; }
public virtual DbSet<Pokemon> Pokemons { get; set; }
public virtual DbSet<PokemonAbility> PokemonAbilities { get; set; }
public virtual DbSet<PokemonMove> PokemonMoves { get; set; }
public virtual DbSet<PokemonType> PokemonTypes { get; set; }
public virtual DbSet<Region> Regions { get; set; }
public virtual DbSet<Trainer> Trainers { get; set; }
public virtual DbSet<Type> Types { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=pokedex_pass;");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Ability>(entity =>
{
entity.HasKey(e => e.AbilityId).HasName("ability_pkey");
entity.Property(e => e.AbilityId).UseIdentityAlwaysColumn();
});
modelBuilder.Entity<CaughtPokemon>(entity =>
{
entity.HasKey(e => e.CaughtPokemonId).HasName("caught_pokemon_pkey");
entity.Property(e => e.CaughtPokemonId).UseIdentityAlwaysColumn();
entity.Property(e => e.CaughtPokemonCatchDate).HasDefaultValueSql("CURRENT_DATE");
entity.HasOne(d => d.CatchRegion).WithMany(p => p.CaughtPokemons)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("caught_pokemon_catch_region_id_fkey");
entity.HasOne(d => d.Pokemon).WithMany(p => p.CaughtPokemons)
.OnDelete(DeleteBehavior.Restrict)
.HasConstraintName("caught_pokemon_pokemon_id_fkey");
entity.HasOne(d => d.Trainer).WithMany(p => p.CaughtPokemons).HasConstraintName("caught_pokemon_trainer_id_fkey");
});
modelBuilder.Entity<Evolution>(entity =>
{
entity.HasKey(e => e.EvolutionId).HasName("evolution_pkey");
entity.Property(e => e.EvolutionId).UseIdentityAlwaysColumn();
entity.HasOne(d => d.FromPokemon).WithMany(p => p.EvolutionFromPokemons).HasConstraintName("evolution_from_pokemon_id_fkey");
entity.HasOne(d => d.ToPokemon).WithMany(p => p.EvolutionToPokemons).HasConstraintName("evolution_to_pokemon_id_fkey");
});
modelBuilder.Entity<Move>(entity =>
{
entity.HasKey(e => e.MoveId).HasName("move_pkey");
entity.Property(e => e.MoveId).UseIdentityAlwaysColumn();
entity.HasOne(d => d.Type).WithMany(p => p.Moves)
.OnDelete(DeleteBehavior.Restrict)
.HasConstraintName("move_type_id_fkey");
});
modelBuilder.Entity<Pokemon>(entity =>
{
entity.HasKey(e => e.PokemonId).HasName("pokemon_pkey");
entity.Property(e => e.PokemonId).UseIdentityAlwaysColumn();
entity.Property(e => e.PokemonCreatedAt).HasDefaultValueSql("CURRENT_TIMESTAMP");
entity.HasOne(d => d.Region).WithMany(p => p.Pokemons)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("pokemon_region_id_fkey");
});
modelBuilder.Entity<PokemonAbility>(entity =>
{
entity.HasKey(e => new { e.PokemonId, e.AbilityId }).HasName("pokemon_ability_pkey");
entity.HasOne(d => d.Ability).WithMany(p => p.PokemonAbilities)
.OnDelete(DeleteBehavior.Restrict)
.HasConstraintName("pokemon_ability_ability_id_fkey");
entity.HasOne(d => d.Pokemon).WithMany(p => p.PokemonAbilities).HasConstraintName("pokemon_ability_pokemon_id_fkey");
});
modelBuilder.Entity<PokemonMove>(entity =>
{
entity.HasKey(e => new { e.PokemonId, e.MoveId, e.PokemonMoveLearnMethod }).HasName("pokemon_move_pkey");
entity.HasOne(d => d.Move).WithMany(p => p.PokemonMoves).HasConstraintName("pokemon_move_move_id_fkey");
entity.HasOne(d => d.Pokemon).WithMany(p => p.PokemonMoves).HasConstraintName("pokemon_move_pokemon_id_fkey");
});
modelBuilder.Entity<PokemonType>(entity =>
{
entity.HasKey(e => new { e.PokemonId, e.TypeId }).HasName("pokemon_type_pkey");
entity.HasOne(d => d.Pokemon).WithMany(p => p.PokemonTypes).HasConstraintName("pokemon_type_pokemon_id_fkey");
entity.HasOne(d => d.Type).WithMany(p => p.PokemonTypes)
.OnDelete(DeleteBehavior.Restrict)
.HasConstraintName("pokemon_type_type_id_fkey");
});
modelBuilder.Entity<Region>(entity =>
{
entity.HasKey(e => e.RegionId).HasName("region_pkey");
entity.Property(e => e.RegionId).UseIdentityAlwaysColumn();
});
modelBuilder.Entity<Trainer>(entity =>
{
entity.HasKey(e => e.TrainerId).HasName("trainer_pkey");
entity.Property(e => e.TrainerId).UseIdentityAlwaysColumn();
entity.Property(e => e.TrainerRegisteredAt).HasDefaultValueSql("CURRENT_TIMESTAMP");
entity.HasOne(d => d.HomeRegion).WithMany(p => p.Trainers)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("trainer_home_region_id_fkey");
});
modelBuilder.Entity<Type>(entity =>
{
entity.HasKey(e => e.TypeId).HasName("type_pkey");
entity.Property(e => e.TypeId).UseIdentityAlwaysColumn();
entity.Property(e => e.TypeColorHex).IsFixedLength();
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[Table("pokemon")]
[Index("PokemonName", Name = "pokemon_pokemon_name_key", IsUnique = true)]
[Index("PokemonNationalDexNumber", Name = "pokemon_pokemon_national_dex_number_key", IsUnique = true)]
public partial class Pokemon
{
[Key]
[Column("pokemon_id")]
public int PokemonId { get; set; }
[Column("pokemon_national_dex_number")]
public int PokemonNationalDexNumber { get; set; }
[Column("pokemon_name")]
[StringLength(50)]
public string PokemonName { get; set; } = null!;
[Column("pokemon_species")]
[StringLength(50)]
public string? PokemonSpecies { get; set; }
[Column("pokemon_height")]
[Precision(4, 2)]
public decimal? PokemonHeight { get; set; }
[Column("pokemon_weight")]
[Precision(5, 2)]
public decimal? PokemonWeight { get; set; }
[Column("pokemon_base_hp")]
public short PokemonBaseHp { get; set; }
[Column("pokemon_base_attack")]
public short PokemonBaseAttack { get; set; }
[Column("pokemon_base_defense")]
public short PokemonBaseDefense { get; set; }
[Column("pokemon_base_sp_attack")]
public short PokemonBaseSpAttack { get; set; }
[Column("pokemon_base_sp_defense")]
public short PokemonBaseSpDefense { get; set; }
[Column("pokemon_base_speed")]
public short PokemonBaseSpeed { get; set; }
[Column("pokemon_is_legendary")]
public bool PokemonIsLegendary { get; set; }
[Column("pokemon_is_mythical")]
public bool PokemonIsMythical { get; set; }
[Column("region_id")]
public int? RegionId { get; set; }
[Column("pokemon_description")]
public string? PokemonDescription { get; set; }
[Column("pokemon_created_at")]
public DateTime PokemonCreatedAt { get; set; }
[InverseProperty("Pokemon")]
public virtual ICollection<CaughtPokemon> CaughtPokemons { get; set; } = new List<CaughtPokemon>();
[InverseProperty("FromPokemon")]
public virtual ICollection<Evolution> EvolutionFromPokemons { get; set; } = new List<Evolution>();
[InverseProperty("ToPokemon")]
public virtual ICollection<Evolution> EvolutionToPokemons { get; set; } = new List<Evolution>();
[InverseProperty("Pokemon")]
public virtual ICollection<PokemonAbility> PokemonAbilities { get; set; } = new List<PokemonAbility>();
[InverseProperty("Pokemon")]
public virtual ICollection<PokemonMove> PokemonMoves { get; set; } = new List<PokemonMove>();
[InverseProperty("Pokemon")]
public virtual ICollection<PokemonType> PokemonTypes { get; set; } = new List<PokemonType>();
[ForeignKey("RegionId")]
[InverseProperty("Pokemons")]
public virtual Region? Region { get; set; }
}
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[PrimaryKey("PokemonId", "AbilityId")]
[Table("pokemon_ability")]
public partial class PokemonAbility
{
[Key]
[Column("pokemon_id")]
public int PokemonId { get; set; }
[Key]
[Column("ability_id")]
public int AbilityId { get; set; }
[Column("pokemon_ability_is_hidden")]
public bool PokemonAbilityIsHidden { get; set; }
[Column("pokemon_ability_slot")]
public short PokemonAbilitySlot { get; set; }
[ForeignKey("AbilityId")]
[InverseProperty("PokemonAbilities")]
public virtual Ability Ability { get; set; } = null!;
[ForeignKey("PokemonId")]
[InverseProperty("PokemonAbilities")]
public virtual Pokemon Pokemon { get; set; } = null!;
}
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[PrimaryKey("PokemonId", "MoveId", "PokemonMoveLearnMethod")]
[Table("pokemon_move")]
public partial class PokemonMove
{
[Key]
[Column("pokemon_id")]
public int PokemonId { get; set; }
[Key]
[Column("move_id")]
public int MoveId { get; set; }
[Key]
[Column("pokemon_move_learn_method")]
[StringLength(20)]
public string PokemonMoveLearnMethod { get; set; } = null!;
[Column("pokemon_move_level_learned")]
public short? PokemonMoveLevelLearned { get; set; }
[ForeignKey("MoveId")]
[InverseProperty("PokemonMoves")]
public virtual Move Move { get; set; } = null!;
[ForeignKey("PokemonId")]
[InverseProperty("PokemonMoves")]
public virtual Pokemon Pokemon { get; set; } = null!;
}
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[PrimaryKey("PokemonId", "TypeId")]
[Table("pokemon_type")]
[Index("PokemonId", "PokemonTypeSlot", Name = "uq_pokemon_slot", IsUnique = true)]
public partial class PokemonType
{
[Key]
[Column("pokemon_id")]
public int PokemonId { get; set; }
[Key]
[Column("type_id")]
public int TypeId { get; set; }
[Column("pokemon_type_slot")]
public short PokemonTypeSlot { get; set; }
[ForeignKey("PokemonId")]
[InverseProperty("PokemonTypes")]
public virtual Pokemon Pokemon { get; set; } = null!;
[ForeignKey("TypeId")]
[InverseProperty("PokemonTypes")]
public virtual Type Type { get; set; } = null!;
}
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[Table("region")]
[Index("RegionName", Name = "region_region_name_key", IsUnique = true)]
public partial class Region
{
[Key]
[Column("region_id")]
public int RegionId { get; set; }
[Column("region_name")]
[StringLength(50)]
public string RegionName { get; set; } = null!;
[Column("region_generation")]
public short RegionGeneration { get; set; }
[Column("region_description")]
public string? RegionDescription { get; set; }
[InverseProperty("CatchRegion")]
public virtual ICollection<CaughtPokemon> CaughtPokemons { get; set; } = new List<CaughtPokemon>();
[InverseProperty("Region")]
public virtual ICollection<Pokemon> Pokemons { get; set; } = new List<Pokemon>();
[InverseProperty("HomeRegion")]
public virtual ICollection<Trainer> Trainers { get; set; } = new List<Trainer>();
}
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[Table("trainer")]
[Index("TrainerEmail", Name = "trainer_trainer_email_key", IsUnique = true)]
public partial class Trainer
{
[Key]
[Column("trainer_id")]
public int TrainerId { get; set; }
[Column("trainer_name")]
[StringLength(50)]
public string TrainerName { get; set; } = null!;
[Column("trainer_email")]
[StringLength(120)]
public string? TrainerEmail { get; set; }
[Column("home_region_id")]
public int? HomeRegionId { get; set; }
[Column("trainer_registered_at")]
public DateTime TrainerRegisteredAt { get; set; }
[InverseProperty("Trainer")]
public virtual ICollection<CaughtPokemon> CaughtPokemons { get; set; } = new List<CaughtPokemon>();
[ForeignKey("HomeRegionId")]
[InverseProperty("Trainers")]
public virtual Region? HomeRegion { get; set; }
}
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApp.Models;
[Table("type")]
[Index("TypeName", Name = "type_type_name_key", IsUnique = true)]
public partial class Type
{
[Key]
[Column("type_id")]
public int TypeId { get; set; }
[Column("type_name")]
[StringLength(30)]
public string TypeName { get; set; } = null!;
[Column("type_color_hex")]
[StringLength(7)]
public string? TypeColorHex { get; set; }
[InverseProperty("Type")]
public virtual ICollection<Move> Moves { get; set; } = new List<Move>();
[InverseProperty("Type")]
public virtual ICollection<PokemonType> PokemonTypes { get; set; } = new List<PokemonType>();
}
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.13">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.3" />
</ItemGroup>
</Project>
@@ -0,0 +1 @@
Console.WriteLine("Hello, World!");