The Legacy Cycle Store follows a classic three-tier web application architecture: an ASP.NET MVC 4 presentation layer handles HTTP requests and renders Razor views, a hand-written business layer in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/aws-samples/legacy-cycle-store-mvc-app/llms.txt
Use this file to discover all available pages before exploring further.
AdventureWorks.Business namespace encapsulates data access logic through Entity Framework 5, and a SQL Server database hosted on Amazon RDS provides durable storage. All three tiers live within a single Visual Studio project, AdventureWorksMVC, contained in the AdventureWorksMVC_2013.sln solution. The AWS infrastructure — RDS instance, Secrets Manager, IAM Role, and Security Group — is declared in a CloudFormation template that ships alongside the source code, making the full environment reproducible from a single stack deployment.
Solution Structure
The solution fileAdventureWorksMVC_2013.sln contains a single C# project targeting .NET Framework 4.5. The project directory is organized into the conventional ASP.NET MVC layout, with a Business/ subfolder added to co-locate EF data-access concerns alongside the MVC project rather than splitting them into a separate class library.
App_Start/ follows the convention introduced in MVC 4: startup registrations (RouteConfig.RegisterRoutes, FilterConfig.RegisterGlobalFilters, WebApiConfig.Register) are called from Global.asax.cs in Application_Start, keeping bootstrapping code modular and out of the HttpApplication subclass.
Presentation Layer
The presentation layer is built on ASP.NET MVC 4 (Microsoft.AspNet.Mvc 4.0.20710.0) with Razor 2 views. Page rendering is decomposed across two controllers: HomeController manages the application entry point, and SiteLayoutController renders the shared chrome as child actions called directly from the master layout.
HomeController
HomeController exposes a single Default action that sets a body CSS class on ViewBag and returns the Default.cshtml view. This is the target of the default route (Home/Default).
SiteLayoutController
SiteLayoutController provides three partial-view actions consumed by _SiteLayout.cshtml via Html.RenderAction. FooterLayout and ContentLayout both call CategoryManager.GetMainCategories() to populate the navigation category list before returning their view models.
Master Layout
Views/Shared/_SiteLayout.cshtml is the Razor master layout. It renders the HeaderLayout child action inline in the <body> tag, wraps @RenderBody() in a YUI grid container, and applies the @ViewBag.BodyClass CSS class set by individual controllers.
SiteLayoutModel view model carries the List<ProductCategory> used to build navigation menus in ContentLayout and FooterLayout:
Business Layer
TheAdventureWorks.Business namespace is the application’s data-access and domain layer. It contains three types of components: the EF-generated DbContext, the T4-generated entity classes, and hand-written manager classes that expose LINQ queries as static methods.
CYCLE_STOREEntities DbContext
CYCLE_STOREEntities is a DbContext subclass generated by the T4 context template (CycleModel.Context.tt). It connects to the database via the CYCLE_STOREEntities named connection string in Web.config and exposes three DbSet properties — one per mapped table.
OnModelCreating override explicitly throws UnintentionalCodeFirstException — a deliberate guard that enforces Database-First mode. If any code-first conventions were to silently build a model from entity classes instead of reading it from the EDMX, EF 5 raises this exception at runtime.
Common — Shared DbContext Accessor
Common is a static helper that provides a shared CYCLE_STOREEntities instance to all manager classes through the DataEntities property. Both CategoryManager and ProductManager reference Common.DataEntities to obtain a context for each query.
CategoryManager
CategoryManager provides static LINQ-based query methods over ProductCategory and ProductSubcategory. GetMainCategories() is called on every page load by SiteLayoutController to populate navigation menus.
ProductManager
ProductManager provides product lookup methods including search by name, subcategory, product ID, color, size, and weight. These queries will require migration from DbSet<Product> to EF Core equivalents in Part 2 of the series.
Data Layer
TheCYCLE_STORE SQL Server database stores all product data under the Production schema. The schema is created by CYCLE_STORE_Schema_data.sql, which ships with the repository and must be executed against the RDS instance after provisioning.
Production Schema Tables
Three tables model the product catalog. They mirror a subset of the canonical AdventureWorks schema:AdventureWorks.Business are generated directly from this schema by the EDMX T4 templates. ProductCategory maintains a navigation property ICollection<ProductSubcategory>, and ProductSubcategory holds a back-reference virtual ProductCategory ProductCategory. These navigation properties are what EF 5 lazy-loads — and what EF Core requires explicit .Include() calls to replace.
AWS Infrastructure
TheSqlServerRDSFixedUidPwd.yaml CloudFormation template provisions all AWS resources required to run the application. Deploying the stack creates five resources in the target account and region:
The RDS instance is configured with
PubliclyAccessible: true and a Security Group that opens TCP port 1433 to 0.0.0.0/0. This configuration is intended for development and demo use only. In any environment handling real data, restrict the Security Group ingress to specific CIDR ranges or VPC security groups, and set PubliclyAccessible to false.CloudFormation Resources
SQLDatabaseEndpoint returns the full hostname:port string used in the application’s Web.config connection string.
Infrastructure Summary
| Resource | Type | Key Configuration |
|---|---|---|
CycleStoreCreds | Secrets Manager Secret | Name: CycleStoreCredentials |
RdsS3FullAccessRole | IAM Role | Grants s3:* to rds.amazonaws.com |
SQLServerSecurityGroup | EC2 Security Group | TCP 1433 open to 0.0.0.0/0 |
OptionGroup | RDS Option Group | SQLSERVER_BACKUP_RESTORE with IAM Role ARN |
SQLDatabase | RDS DB Instance | sqlserver-ex 14.00, db.t2.micro, 20 GB |
MVC Routing
Route registration happens inApp_Start/RouteConfig.cs, called from Global.asax.cs during Application_Start. The application uses a single conventional route with the Home controller and Default action as the entry point:
Global.asax.cs wires all App_Start registrations during application startup:
/), the route engine matches it to Home/Default/ and dispatches to HomeController.Default(), which sets ViewBag.BodyClass = "homepage" and renders Views/Home/Default.cshtml within the _SiteLayout.cshtml master layout.
Project Structure
Detailed walkthrough of every directory and file in the Visual Studio solution.
Data Model
Full schema reference for the CYCLE_STORE database and the EDMX entity mappings.
Business Layer
Deep dive into CategoryManager, ProductManager, and the Common DbContext accessor pattern.
MVC Layer
Controllers, Razor views, view models, and the SiteLayout child action pattern explained.