Modernize SampleMvcWebApp to cross-platform .NET 8 (ASP.NET Core MVC + EF Core 8) - #23
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Modernize SampleMvcWebApp to cross-platform .NET 8 (ASP.NET Core MVC + EF Core 8)#23devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…MVC on .NET 8 - Convert all projects to SDK-style net8.0 - MVC5/System.Web -> ASP.NET Core MVC (Program.cs, middleware, built-in DI) - EF6 -> EF Core 8 (SQLite, migrations) preserving data model + validation - In-repo GenericServices/GenericLibsBase compatibility port on EF Core 8 + AutoMapper 14 - Autofac -> built-in DI; log4net -> Microsoft.Extensions.Logging; web.config -> appsettings.json - Replace legacy NUnit2/.NET4.5 tests with net8.0 NUnit4 regression suite for CRUD/service behavior - Add GitHub Actions CI for .NET 8 build+test; update README Co-Authored-By: Achal Channarasappa <achal.channarasappa@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the app from ASP.NET MVC 5 / .NET Framework 4.5.1 to cross-platform ASP.NET Core MVC on .NET 8, preserving all pages, CRUD flows, and business rules. Every project is now SDK-style
net8.0;System.Web,Global.asax,web.config,packages.config, Autofac, and log4net are gone. The solution builds clean (0 warnings) and anet8.0NUnit 4 suite (17 tests) passes.The app depends on the GenericServices framework, which is EF6-only with no .NET 8 build. Rather than rewrite every DTO/controller onto a different framework (behavior-risky), this PR ports the exact GenericServices/GenericLibsBase API surface the app uses into two small in-repo
net8.0libraries backed by EF Core 8 + AutoMapper 14, so DTOs and controller call-sites stay essentially unchanged.Architecture: MVC5 → ASP.NET Core MVC
Global.asax+App_Start/*(Route/Bundle/Filter config) →Program.cs(middleware, routing, DI, DB init).DiModelBinder(which enabled action-parameter service injection likeIndex(IListService service)) → built-in DI. To keep the original controller signatures unchanged, a smallServiceParameterBindingConventionmarks action parameters whose type is a registered service asBindingSource.Services:@Styles.Render/@Scripts.Render) → static<link>/<script>tags served fromwwwroot/(Content, Scripts, fonts moved there).MvcHtmlStringerror HTML inTempData["errorMessage"]→ plain string rendered with@Html.Raw(...)(identical output).Microsoft.Extensions.Loggingvia aMelGenericLogger : IGenericLoggerbridge wired throughGenericLibsBaseConfig.InternalsInfoWindows-onlyPerformanceCounter→ cross-platformGC.GetGCMemoryInfo().web.config/Settings→appsettings.json(connection string +HostTypeString).Architecture: EF6 → EF Core 8
SampleWebAppDbis now an EF CoreDbContextimplementingIGenericServicesDbContext+IValidateOnSave; default provider is SQLite (Data Source=SampleWebAppDb.db) for cross-platform demo use.Blog,Post,Tag,Post.BlogId, many-to-manyPost/Tag,LastUpdatedstamping, XML seed loading, and small/medium reset semantics. Initial EF Core migration added underDataLayer/Migrations.DbContext.ValidateEntity(no EF Core equivalent) →IValidateOnSave.ValidateEntity, invoked by the portedSaveChangesWithChecking, preserving the unique-tag-slug rule and error text.Tags), a reflection copier (EntityFromDto) copies scalars and assigns navigations by reference so EF Core tracks them; AutoMapper is used only for entity→DTO reads/projections (ProjectTo).Changed dependencies (and why)
NuGetAuditSuppressforGHSA-rvv3-g6hj-g44xis applied and documented; no security setting was weakened.Microsoft.EntityFrameworkCore.Sqlite/.Design8.0.11), built-in DI,Microsoft.Extensions.Logging.Test evidence
dotnet build SampleWebApp.sln→ 0 warnings, 0 errors (Debug + Release).dotnet test SampleWebApp.sln→ 17 passed, 0 failed.dotnet run --project SampleWebApp): DB auto-migrates + seeds; verified200for Home, Posts/Tags/Blogs (sync + async), Details, Edit, Create, Internals, CodeView, Delay. Verified a full write path via HTTP with antiforgery token: create Tag →302+ appears in list; duplicate slug → validation error rendered.LastUpdatedstamping, list projections/flattening (PostsCount,BloggerName,Tags), detail/edit setup pickers, update (title + tag replacement), create with tags, delete, async detail/create, and business-rule rejections (no blogger, no tags,!title, duplicate slug).Remaining risks
Human-review checklist
UseSqlitecall + connection string for SQL Server).EntityFromDtonavigation-by-reference copy vs. the original AutoMapper write behavior.ServiceParameterBindingConventionas the replacement for the MVC5DiModelBinder.GHSA-rvv3-g6hj-g44xsuppression.Rollback guidance
Single-branch change with no data migration of existing stores (new local SQLite file is created on first run). To roll back, revert the merge commit / redeploy the previous build; delete the generated
SampleWebAppDb.dbif present. No external infrastructure was modified.Link to Devin session: https://app.devin.ai/sessions/96f873d8bcf34290ab2609be7b941738
Requested by: @achalc
Devin Review