Skip to content

Add comprehensive PostgreSQL EF Core migrations tutorial for .NET Aspire #4189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 4, 2025

This PR addresses the critical gap in .NET Aspire documentation by providing a comprehensive tutorial for PostgreSQL Entity Framework Core migrations - something that has been repeatedly requested by the community but was missing from the documentation.

What this adds

New Tutorial: postgresql-ef-core-migrations-tutorial.md - A complete 314-line, step-by-step guide that covers:

  • Setting up .NET Aspire projects with PostgreSQL and Entity Framework Core from scratch
  • Creating and configuring EF Core models and database contexts
  • Actually creating migrations (not just applying existing ones) - the core missing piece
  • Building and configuring migration services for automatic schema deployment
  • PostgreSQL-specific patterns and troubleshooting scenarios
  • Complete working application with data persistence

Complete Working Code Examples: All tutorial code is fully functional with 9 supporting files including:

  • Entity models with PostgreSQL-optimized configurations
  • DbContext setup for PostgreSQL
  • Migration service implementation for automatic schema updates
  • App host orchestration with proper service dependencies
  • Complete Blazor UI for testing the end-to-end workflow

Why this was needed

The existing documentation had:

  • A general EF Core migrations guide focused on SQL Server
  • PostgreSQL integration docs without migration coverage
  • No end-to-end tutorial showing how to create migrations (only apply existing ones)

This left developers unable to figure out how to:

  • Generate PostgreSQL migrations in .NET Aspire projects
  • Set up migration services for PostgreSQL
  • Handle PostgreSQL-specific differences from SQL Server examples

Key differentiators from existing content

Unlike the existing SQL Server tutorial, this focuses specifically on:

  • PostgreSQL container orchestration patterns
  • PostgreSQL-specific EF Core configuration
  • Handling connection string challenges with containerized PostgreSQL
  • PostgreSQL naming conventions and data type considerations
  • Common PostgreSQL + .NET Aspire troubleshooting scenarios

The tutorial provides the "real end-to-end tutorial that shows how to actually create migrations" that was explicitly requested in the issue, with working code that developers can follow from start to finish.

Fixes #1581.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Internal previews

📄 File 🔗 Preview link
docs/database/postgresql-ef-core-migrations-tutorial.md docs/database/postgresql-ef-core-migrations-tutorial
docs/toc.yml docs/toc

@Copilot Copilot AI changed the title [WIP] Please please please write real doc Entity Framework + Postgres Migrations Add comprehensive PostgreSQL EF Core migrations tutorial for .NET Aspire Aug 4, 2025
Copilot finished work on behalf of IEvangelist August 4, 2025 20:52
@Copilot Copilot AI requested a review from IEvangelist August 4, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please please please write real doc Entity Framework + Postgres Migrations
2 participants