Skip to content

Pokedex Data

Robyn Stanco edited this page Jun 26, 2022 · 14 revisions
The data project utilizes EntityFrameworkCore as an ORM to convert MS SQL database tables into hard typed entity objects.

POKEDEXDBContext

This class inherits from DbContext, who's instance represents a session with the POKEDEXDB, allowing you to query the database. This class contains all DbSets, constraints, and entities for the POKEDEXDB. It is referenced via a Repository pattern within Pokedex Repository.

Models (Entities)

tblMyPokedex
Name Data Type
Id Guid
PokemonId int
Nickname string
Level int?
Sex int?
Date DateTime?
Location string
PokeballId int
Pokeball tlkpPokeball
Pokemon tlkpNationalDex
tlkpAbility
Name Data Type
Id int
Name string
tlkpNationalDexAbility ICollection of tlkpNationalDex
tlkpNationalDexHiddenAbility ICollection of tlkpNationalDex
tlkpCategory
Name Data Type
Id int
Name string
tlkpNationalDex ICollection of tlkpNationalDex
tlkpNationalDex
Name Data Type
Id int
Name string
Japanese Name string
Description string
CategoryId int?
TypeOneId int?
TypeTwoId int?
AbilityId int?
HiddenAbilityId int?
ImageURL string
HeightInInches int
WeightInPounds int
Ability tlkpAbility
Category tlkpCategory
HiddenAbility tlkpAbility
TypeOne tlkpType
TypeTwo tlkpType
tblMyPokedex ICollection of tblMyPokedex
tlkpPokeball
Name Data Type
Id int
Name string
ImageURL string
tbkMyPokedex ICollection of tblMyPokedex
tlkpType
Name Data Type
Id int
Name string
tlkpNationalDexTypeOne ICollection of tlkpNationalDex
tlkpNationalDexTypeTwo ICollection of tlkpNationalDex

Scaffold-DbContext

EntityFrameworkCore provides developers with a handy command to automatically generate the necessary DBContext and models given parameters.
Scaffold-DbContext "Data Source=(localdb)\\MSSQLLocalDB;initial catalog=POKEDEXDB;integrated security=True;" Microsoft.EntityFrameworkCore.SqlServer -UseDatabaseNames -Tables tlkpAbility, tlkpCategory, tlkpNationalDex, tlkpPokeball, tlkpType, tblMyPokedex -OutputDir Models -ContextDir . -Force
Clone this wiki locally