Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,49 @@
SampleMvcWebApp
===============

## 🚀 .NET 6 Migration Progress

**Current Status**: Foundation Phase Complete ✅

This repository is currently undergoing migration from .NET Framework 4.5.1 to .NET 6. The migration is being done incrementally to maintain stability and allow for thorough testing at each phase.

### ✅ Completed (Phase 1 - Foundation)
- **New .NET 6 Project**: Created `SampleWebApp.Core` project with modern SDK-style format
- **Project Structure**: Established standard .NET 6 folder structure (Controllers/, Views/, Models/, wwwroot/)
- **Configuration**: Migrated from Web.config to appsettings.json with environment-specific configurations
- **Hosting Model**: Implemented minimal hosting pattern with modern ASP.NET Core middleware pipeline
- **Build Verification**: Project builds successfully and runs locally
- **Environment Support**: Development, Staging, and Production environment configurations

### 🔄 In Progress / Next Steps
- Migrate existing controllers and views from `SampleWebApp` to `SampleWebApp.Core`
- Update Entity Framework 6 to Entity Framework Core
- Migrate dependency injection from AutoFac to built-in .NET 6 DI container
- Port GenericServices framework to work with .NET 6
- Update authentication and authorization mechanisms
- Migrate static assets and client-side resources

### 📁 Project Structure
```
SampleMvcWebApp/
├── SampleWebApp/ # Original .NET Framework 4.5.1 MVC5 application
├── SampleWebApp.Core/ # New .NET 6 Web Application (migration target)
├── DataLayer/ # Shared data layer (to be migrated to EF Core)
├── ServiceLayer/ # Shared service layer
├── BizLayer/ # Business logic layer
└── Tests/ # Test projects
```

### 🔗 Related Work
- **Ticket**: NET-15 - Create .NET Core 6 Web Application Project
- **Pull Request**: [#1](https://github.com/COG-GTM/SampleMvcWebApp/pull/1)

---

## About the Original Application

SampleMvcWebApp is a ASP.NET MVC5 web site designed to show number of useful methods for building enterprise
grade web applications using ASP.NET MVC5 and Entity Framework 6.
grade web applications using ASP.NET MVC5 and Entity Framework 6.
The code for this sample MVC web application, and the associated
[GenericServices Framework](https://github.com/JonPSmith/GenericServices) are both an open source project
by [Jon Smith](http://www.thereformedprogrammer.net/about-me/)
Expand Down
16 changes: 16 additions & 0 deletions SampleWebApp.Core/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Mvc;

namespace SampleWebApp.Core.Controllers;

public class HomeController : Controller
{
public IActionResult Index()
{
return Content("SampleWebApp.Core - .NET 6 Web Application is running!");
}

public IActionResult Error()
{
return Content("An error occurred.");
}
}
22 changes: 22 additions & 0 deletions SampleWebApp.Core/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllersWithViews();

var app = builder.Build();

if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();

app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");

app.Run();
38 changes: 38 additions & 0 deletions SampleWebApp.Core/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"profiles": {
"SampleWebApp.Core": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7001;http://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"SampleWebApp.Core.Staging": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7002;http://localhost:5002",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Staging"
}
},
"SampleWebApp.Core.Production": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7003;http://localhost:5003",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
15 changes: 15 additions & 0 deletions SampleWebApp.Core/SampleWebApp.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<!-- Project references will be added during migration phase -->
<!-- <ItemGroup>
<ProjectReference Include="..\DataLayer\DataLayer.csproj" />
<ProjectReference Include="..\ServiceLayer\ServiceLayer.csproj" />
</ItemGroup> -->

</Project>
11 changes: 11 additions & 0 deletions SampleWebApp.Core/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ApplicationSettings": {
"HostTypeString": "LocalHost"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
11 changes: 11 additions & 0 deletions SampleWebApp.Core/appsettings.Production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ApplicationSettings": {
"HostTypeString": "Production"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft.AspNetCore": "Error"
}
}
}
11 changes: 11 additions & 0 deletions SampleWebApp.Core/appsettings.Staging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ApplicationSettings": {
"HostTypeString": "Staging"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft.AspNetCore": "Warning"
}
}
}
15 changes: 15 additions & 0 deletions SampleWebApp.Core/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ConnectionStrings": {
"SampleWebAppDb": "Data Source=(localdb)\\mssqllocaldb;Initial Catalog=SampleWebAppDb;MultipleActiveResultSets=True;Integrated Security=SSPI;Trusted_Connection=True"
},
"ApplicationSettings": {
"HostTypeString": "LocalHost",
"DatabaseLoginPrefix": "jonsmith_"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
10 changes: 10 additions & 0 deletions SampleWebApp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceLayer", "ServiceLaye
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{6D9E7904-B2AC-49E3-83A7-6B48876F46B9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleWebApp.Core", "SampleWebApp.Core\SampleWebApp.Core.csproj", "{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AF8764F7-FBEE-48AD-AF62-23010DA35D70}"
ProjectSection(SolutionItems) = preProject
Licence.txt = Licence.txt
Expand Down Expand Up @@ -56,6 +58,14 @@ Global
{6D9E7904-B2AC-49E3-83A7-6B48876F46B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D9E7904-B2AC-49E3-83A7-6B48876F46B9}.Release|Any CPU.Build.0 = Release|Any CPU
{6D9E7904-B2AC-49E3-83A7-6B48876F46B9}.WebWizRelease|Any CPU.ActiveCfg = WebWizRelease|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.AzureRelease|Any CPU.ActiveCfg = Release|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.AzureRelease|Any CPU.Build.0 = Release|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.Build.0 = Release|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.WebWizRelease|Any CPU.ActiveCfg = Release|Any CPU
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.WebWizRelease|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down