Skip to content

jia-von/entity-framework-solution-setup-from-existing-database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C# Object-Orientated Programming

Entity Framework Solution Setup From Existing Database.

  • The goal of this assignment is to be familiarized with the fundementals of importing a databse to C# using Entity Framework.
  • The scenario for this assignment is to build an exising database using MySQL and MariaDB and then building C# sever later.

Installation

$ git clone https://github.com/jia-von/entity-framework-solution-setup-from-existing-database.git
$ cd entity-framework-solution-setup-from-existing-database-jia-von
$ cd ExistingDBPractice
$ start devenv ExistingDBPractice.sln
PM> dotnet add package Microsoft.EntityFrameworkCore.Design
PM> dotnet add package Pomelo.EntityFrameworkCore.MySQL

Usage/Approach

  • The database was populated in PHPMyAdmin using a SQL script. The database is named existing_db_practice.
  • The database contains two tables Person and PhoneNumber.
  • A PersonContext.cs model was created and configured to target models Person.cs and PhoneNumber.cs and the relational database.
  • A simple program was written to take the first name from the user and then to pring the full name of the user from the database.