Skip to content

PapeMarc/Vortrag_MicrosoftEntityFramework

Repository files navigation

Microsoft Entity Framework Demo

This repository contains a minimal console application demonstrating how to use Entity Framework Core with a MariaDB/MySQL database. It was created as sample code for a talk and shows basic tasks such as creating a context, seeding data and applying migrations.

Repository

https://github.com/PapeMarc/Vortrag_MicrosoftEntityFramework

Prerequisites

  • .NET 8 SDK
  • MariaDB or MySQL server available on localhost:3306
  • A config.txt file in the project root containing the password for the root database user
  • Optionally: dotnet-ef tools for running migrations

Getting Started

  1. Ensure the database test exists and the root user can access it.
  2. Create a file named config.txt next to the project with only the database password as its contents.
  3. Apply the initial migration to create the schema:
    dotnet ef database update
  4. Run the application:
    dotnet run
    The program adds several users to the database, removes the last inserted user, saves the changes and prints all users to the console.

Project Structure

  • Data/AppDbContext.cs – EF Core database context and connection configuration.
  • Model/User.cs – Simple user entity.
  • Migrations/ – Initial migration for creating the User table.
  • Program.cs – Entry point demonstrating basic CRUD operations.

License

This project is provided as-is for demonstration purposes.

About

Dieses Repository enthält den im Vortrag verwendeten Quelltext.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages