By Jeremy Banka
- ๐ต C# / .NET 5 Framework
- ๐๏ธ ASP.NET Core Server
- ๐งฎ MySQL Database
- ๐ Entity Framework Core
- ๐ช Razor Templating
- ๐ SCSS to CSS via Ritwick's Live Sass Compiler
- ๐ ๏ธ Tooling: Omnisharp
๐ ฐ๏ธ Fonts: Verdana & Charter by Matthew Carter
This website is an exercise in using Microsoft's Entity Framework Core to abstract the process of reading from and writing to a MySQL database.
-
Get the source code:
$ git clone https://github.com/jeremybanka/HairSalon.Solution
-
Set up a compatible database. There are two ways of going about this. I recommend the first.
- Import my configuration
- Find
jeremy_banka.sql
in the root folder. - In MySQL Workbench, find the 'Administration' tab in the upper left of the application.
- Under that tab, click 'Data Import/Restore'.
- Select the radio option 'Import from Self-Contained File' and browse to the
.sql
file located earlier. - If you want a few example entries in the database pre-made, pick 'Dump Structure and Data' in the dropdown near the bottom. If you want to see the empty-state first, select 'Dump Structure Only'.
- Click 'Start Import'.
- Once complete, go back to the 'Schemas' tab next to administration and refresh using the tiny ๐ button.
- The app won't do this for you.
- Why would it?
- Find
- Set it up yourself
- If you picked this option, I'm gonna assume you know what you're doing.
- Make a new schema
hair_salon
. - Add two tables
clients
,stylists
. - In
clients
add three columnsClientId
:VARCHAR(36)
withPK
(primary key) andNN
(not null) options picked.Name
:VARCHAR(45)
StylistId
:VARCHAR(36)
these aren'tINT
s because I'm usingSystem.Guid
.
- In
stylists
add two columnsStylistId
:VARCHAR(36)
withPK
(primary key) andNN
(not null) options picked.Name
:VARCHAR(45)
- Import my configuration
-
Add
appsettings.json
inHairSalon/
and paste in the following text:{ "ConnectionStrings": { "DefaultConnection": "Server=localhost;Port=3306;database=hair_salon;uid=root;pwd=************;" } }
except, instead of
************
put your password for MySQL. -
Compile and run the WebApp as you save changes:
$ dotnet watch run
inHairSalon/
(This command will also install necessary dependencies.)
- none identified
Gnu Public License ^3.0
hello at jeremybanka dot com