Skip to content

Zure/ContosoUniversity

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contoso University - Migrate and Modernize MicroHack

Welcome to the Migrate and Modernize MicroHack workshop repository! This hands-on learning experience is designed for technical professionals and decision-makers who want to accelerate their cloud transformation journey.

About This Workshop

The Migrate and Modernize MicroHack combines practical guidance with real-world scenarios to help you:

  • Strengthen your security posture and ensure business continuity across hybrid environments
  • Modernize application development using AI-powered tools for faster innovation

Track: Modernize Your Applications with GitHub Copilot

Accelerate innovation by transforming how you build and maintain applications. This track covers:

  • AI-powered Development: Use GitHub Copilot and GitHub Spec-Kit to write code faster and reduce repetitive tasks
  • Modern App Architecture: Explore best practices for containerization, microservices, and CI/CD pipelines
  • Hands-on Labs: Experience real-world scenarios where AI assists in coding and debugging

Outcome: Empower your teams to deliver modern, scalable applications with speed and confidence.

About the Application

Contoso University is an ASP.NET Core Razor Pages web application that demonstrates enterprise patterns for managing a university system, including students, courses, instructors, and departments. This sample application serves as a realistic codebase for practicing modernization techniques.

Prerequisites

Note: Install .NET 9.0 SDK. You do not need .NET 6.0 unless you specifically want to run the old version first—this is not required. Simply run the first lab and verify the functionality with the new version.

Alternatively, if you prefer, you can ask LLM agents (like GitHub Copilot or Claude) to help install required tools as you go along—they can guide you through the installation process interactively.

Mac Prerequisites

Windows Prerequisites

Getting Started

Step 1: Clone the Repository

git clone <repository-url>
cd ContosoUniversity

Step 2: Start SQL Server Database

On Mac

Using Docker:

docker run \
  --platform linux/amd64 \
  -e "ACCEPT_EULA=Y" \
  -e "MSSQL_SA_PASSWORD=YourStrong@Passw0rd123" \
  -p 1433:1433 \
  --name sql2022 \
  --hostname sql2022 \
  -d \
  mcr.microsoft.com/mssql/server:2022-latest

Using Podman:

chmod +x run-sqlserver.sh
./run-sqlserver.sh

Or manually:

podman run \
  --platform linux/amd64 \
  -e "ACCEPT_EULA=Y" \
  -e "MSSQL_SA_PASSWORD=YourStrong@Passw0rd123" \
  -p 1433:1433 \
  --name sql2022 \
  --hostname sql2022 \
  -d \
  mcr.microsoft.com/mssql/server:2022-latest

On Windows (using Docker)

Create and run a SQL Server container with PowerShell:

docker run `
  -e "ACCEPT_EULA=Y" `
  -e "MSSQL_SA_PASSWORD=YourStrong@Passw0rd123" `
  -p 1433:1433 `
  --name sql2022 `
  --hostname sql2022 `
  -d `
  mcr.microsoft.com/mssql/server:2022-latest

Or with CMD:

docker run ^
  -e "ACCEPT_EULA=Y" ^
  -e "MSSQL_SA_PASSWORD=YourStrong@Passw0rd123" ^
  -p 1433:1433 ^
  --name sql2022 ^
  --hostname sql2022 ^
  -d ^
  mcr.microsoft.com/mssql/server:2022-latest

Note: The default SA password is YourStrong@Passw0rd123 (as configured in appsettings.json)

Step 3: Initialize the Database

Navigate to the application directory and run the migrations:

cd ContosoUniversity
dotnet ef database update

If Entity Framework tools are not installed, install them first:

dotnet tool install --global dotnet-ef

Step 4: Run the Application

dotnet run

The application will start and be available at:

  • HTTPS: https://localhost:7054
  • HTTP: http://localhost:5054

(Port numbers may vary - check the console output)

Step 5: Verify the Setup

Open your browser and navigate to the application URL. You should see the Contoso University home page with navigation to Students, Courses, Instructors, and Departments.

Managing the SQL Server Container

Stop the container

docker stop sql2022
# or with Podman: podman stop sql2022

Start the container

docker start sql2022
# or with Podman: podman start sql2022

Remove the container

docker rm sql2022
# or with Podman: podman rm sql2022

View logs

docker logs sql2022
# or with Podman: podman logs sql2022

Workshop Labs

This repository includes hands-on labs in the Labs/ folder:

Core Labs

  1. Introduction to Spec-Kit - Learn GitHub's Spec-Driven Development approach by updating the .NET version
  2. UI Modernization - Move the UI from Razor Pages to a modern React application
  3. Git Worktrees - Work on multiple features simultaneously using git worktrees

Optional Feature Labs

  1. Dockerization - Containerize the entire application
  2. UI Enhancement - Modernize the look and feel
  3. Course-Instructor Assignment - Add instructor assignment functionality
  4. Course Scheduling - Add date/time management to courses
  5. Course Registration - Enable student course registration
  6. Semester View - Create a personalized semester course view

Each lab includes detailed instructions, learning objectives, and expected outcomes.

Troubleshooting

Database Connection Issues

If you get connection errors:

  1. Verify the SQL Server container is running: docker ps or podman ps
  2. Check the connection string in ContosoUniversity/appsettings.json
  3. Ensure the SA password matches between the container and connection string

Port Conflicts

If port 1433 is already in use:

  1. Stop any existing SQL Server instances
  2. Or modify the port mapping in the container startup command and update appsettings.json

Container Management

To check if your SQL Server container is running:

docker ps
# or with Podman: podman ps

Migration Issues

If migrations fail:

  1. Ensure the database container is running
  2. Try: dotnet ef database drop (WARNING: This deletes all data)
  3. Then: dotnet ef database update

Resources

Workshop Agenda

  • 09:00 – 09:30: Opening
  • 09:30 – 09:50: GitHub Copilot and spec-driven development
  • 09:50 – 10:10: GitHub Modernization agent
  • 10:10 – 10:20: Break
  • 10:20 – 11:00: 1. Hackathon task
  • 11:00 – 12:00: Lunch
  • 12:00 – 12:20: GitHub Modernization results
  • 12:20 – 14:30: 2. Hackathon task
  • 14:30 – 15:00: Coffee break
  • 15:00 – 16:00: 3. Hackathon task
  • 16:00 – 16:45: Review and learnings
  • 16:45 – 17:00: Closing words

Support

If you encounter issues during the workshop, please reach out to the facilitators or open an issue in this repository.

Happy hacking! 🚀

About

Contoso University built using ASP.NET Core Razor Pages and EF Core on .NET 6. See; https://docs.microsoft.com/en-us/aspnet/core/data/ef-rp/.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 60.8%
  • HTML 37.1%
  • Other 2.1%