Skip to content

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 Tutorial: PostgreSQL migrations with Entity Framework Core in .NET Aspire
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
@IEvangelist IEvangelist self-requested a review October 1, 2025 20:37
@IEvangelist IEvangelist dismissed their stale review October 1, 2025 20:37

Seriously..

@IEvangelist IEvangelist marked this pull request as ready for review October 1, 2025 20:38
@Copilot Copilot AI review requested due to automatic review settings October 1, 2025 20:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a critical documentation gap by providing a comprehensive tutorial specifically for PostgreSQL Entity Framework Core migrations in .NET Aspire applications. The tutorial walks through creating migrations from scratch, which was a key missing piece in the existing documentation that only covered applying existing migrations.

  • Complete step-by-step PostgreSQL EF Core migrations tutorial with working code examples
  • Migration service implementation for automatic schema deployment in .NET Aspire
  • PostgreSQL-specific patterns and troubleshooting guidance distinct from SQL Server examples

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

File Description
docs/toc.yml Adds new tutorial entry to the table of contents under database section
docs/database/postgresql-ef-core-migrations-tutorial.md New comprehensive 314-line tutorial covering PostgreSQL EF Core migrations creation and management
docs/database/snippets/postgresql-ef-core-tutorial/* Nine supporting code files providing complete working examples for the tutorial

---
title: Tutorial - PostgreSQL migrations with Entity Framework Core in .NET Aspire
description: Learn how to create, apply, and manage PostgreSQL migrations using Entity Framework Core in .NET Aspire applications.
ms.date: 10/01/2025
Copy link
Preview

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The date 10/01/2025 is in the future. Based on the current date context (October 2025), this should likely be a past date when the content was actually created.

Suggested change
ms.date: 10/01/2025
ms.date: 10/01/2024

Copilot uses AI. Check for mistakes.

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