Skip to content

Daaiid/RazorTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RazorTemplate

This project aims at providing a minimal sample project with ASP.NET RazorPages. It uses a containerized Postgres instance as its database and uses EntityFramework Core for ORM (Object Relational Mapping), data schema definition, and migrations. The template targets .NET 8.

Setup

Database Administration

To start just the database container, you can run docker compose -f stack.dev.yml up Check the YAML definition for details like volumes, port mapping etc.

On a fresh DB we need to first apply the data model. The command for that: dotnet ef database update This applies the latest database migration.

To make changes to the data model:

  • Change the DB code
    • Entities to change the tables
    • DbSet<> properties to add or remove tables
  • Run dotnet ef migration add <migration name>. <migration_name> will give the migration a name.
    • Give it a descriptive name, similar to git commit messages.
  • Apply the new migration
    • dotnet ef database update

References

About

A generic .NET Razor sample project using EF Core and Postgres

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published