Skip to content

refactor: consolidate common @using directives into _Imports.razor files#4

Merged
mpaulosky merged 2 commits into
mainfrom
squad/razor-imports-consolidation
Apr 18, 2026
Merged

refactor: consolidate common @using directives into _Imports.razor files#4
mpaulosky merged 2 commits into
mainfrom
squad/razor-imports-consolidation

Conversation

@mpaulosky

Copy link
Copy Markdown
Owner

Summary

This PR consolidates common @using directives from individual .razor files into the appropriate _Imports.razor files to reduce duplication and improve maintainability.

Changes

Features/_Imports.razor

Added:

  • @using Microsoft.AspNetCore.Authorization
  • @using MediatR

Removed redundant usings from:

Features/BlogPosts/Create/Create.razor

  • Removed @using MediatR
  • Removed @using Microsoft.AspNetCore.Authorization

Features/BlogPosts/List/Index.razor

  • Removed @using MediatR
  • Removed @using MyBlog.Web.Data
  • Removed @using Microsoft.AspNetCore.Components.Authorization

Features/BlogPosts/Edit/Edit.razor

  • Removed @using MediatR
  • Removed @using MyBlog.Web.Data
  • Removed @using Microsoft.AspNetCore.Authorization

Features/UserManagement/ManageRoles.razor

  • Removed @using MediatR
  • Removed @using Microsoft.AspNetCore.Authorization

Features/UserManagement/Profile.razor

  • Removed @using Microsoft.AspNetCore.Authorization
  • Kept file-specific usings: System.Security.Claims, MyBlog.Web.Security

Features/BlogPosts/Delete/ConfirmDeleteDialog.razor

  • Removed @using Microsoft.AspNetCore.Components

Components/Layout/NavMenu.razor

  • Removed @using Microsoft.AspNetCore.Components.Authorization

Components/Routes.razor

  • Removed @using Microsoft.AspNetCore.Components.Authorization

Verification

✅ Build succeeded with 0 errors: dotnet build MyBlog.slnx --configuration Release

Notes

  • All common usings are now centralized in appropriate _Imports.razor files
  • File-specific usings (feature namespaces, specialized types) remain in individual files
  • No functional changes, purely code organization improvement

- Added MediatR and Microsoft.AspNetCore.Authorization to Features/_Imports.razor
- Removed redundant @using directives from individual .razor files:
  - Features/BlogPosts/Create/Create.razor
  - Features/BlogPosts/List/Index.razor
  - Features/BlogPosts/Edit/Edit.razor
  - Features/UserManagement/ManageRoles.razor
  - Features/UserManagement/Profile.razor
  - Features/BlogPosts/Delete/ConfirmDeleteDialog.razor
  - Components/Layout/NavMenu.razor
  - Components/Routes.razor
- All common usings now centralized in appropriate _Imports.razor files
- File-specific usings (feature namespaces, specialized types) retained in individual files
- Build verified: 0 errors

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 18, 2026 18:58
…tion

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mpaulosky
mpaulosky merged commit 60426b1 into main Apr 18, 2026
@mpaulosky
mpaulosky deleted the squad/razor-imports-consolidation branch April 18, 2026 19:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Consolidates repeated Razor @using directives into the appropriate folder-level _Imports.razor files (primarily under Features) to reduce per-component duplication and simplify maintenance.

Changes:

  • Added common @using Microsoft.AspNetCore.Authorization and @using MediatR to src/Web/Features/_Imports.razor.
  • Removed now-redundant @using directives from several Feature pages/components.
  • Removed redundant authorization usings from shared Components where they’re already covered by Components/_Imports.razor.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Web/Features/_Imports.razor Centralizes Microsoft.AspNetCore.Authorization and MediatR for all Feature pages.
src/Web/Features/UserManagement/Profile.razor Removes redundant Microsoft.AspNetCore.Authorization using; relies on Features imports.
src/Web/Features/UserManagement/ManageRoles.razor Removes redundant MediatR/authorization usings; relies on Features imports.
src/Web/Features/BlogPosts/List/Index.razor Removes redundant MediatR/Data/auth usings; relies on Features imports.
src/Web/Features/BlogPosts/Edit/Edit.razor Removes redundant MediatR/Data/auth usings; relies on Features imports.
src/Web/Features/BlogPosts/Delete/ConfirmDeleteDialog.razor Removes redundant Microsoft.AspNetCore.Components using.
src/Web/Features/BlogPosts/Create/Create.razor Removes redundant MediatR/auth usings; relies on Features imports.
src/Web/Components/Routes.razor Removes redundant authorization using; covered by Components/_Imports.razor.
src/Web/Components/Layout/NavMenu.razor Removes redundant authorization using; covered by Components/_Imports.razor.

mpaulosky added a commit that referenced this pull request Apr 18, 2026
Scribe: Finalize session completion for Legolas razor-imports work

- Write orchestration logs (Legolas & Boromir)
- Write session log for PR #4 merge
- Merge decision inbox → decisions.md
- Remove processed inbox files

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mpaulosky added a commit that referenced this pull request Apr 18, 2026
* ci: add PR build and test workflow

- Build solution in Release mode
- Run all three test suites (Architecture, Unit, Integration)
- Collect code coverage with coverlet
- Report test results with dorny/test-reporter
- Post coverage summary as PR comment
- Cache NuGet packages for faster builds

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: Consolidate squad orchestration from PR #4 merge

Scribe: Finalize session completion for Legolas razor-imports work

- Write orchestration logs (Legolas & Boromir)
- Write session log for PR #4 merge
- Merge decision inbox → decisions.md
- Remove processed inbox files

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: update Boromir history and decision record for CI workflow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mpaulosky added a commit that referenced this pull request Apr 18, 2026
Merge boromir-pr9-review-fixes.md inbox item into decisions.md as
decision #4 — CI Workflow Conventions. Five conventions established:
- Always use global-json-file: global.json in setup-dotnet
- Use nuGetVersion for /p:Version in dotnet build
- squad-test.yml triggers on pull_request only
- Surgical use of continue-on-error
- Comments must not contradict code

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mpaulosky added a commit that referenced this pull request Apr 18, 2026
## Summary

Closes the decisions inbox — merges `boromir-pr9-review-fixes.md` into
`.squad/decisions.md` as **Decision #4: CI Workflow Conventions**.

Working as **Scribe** (Documentation & Knowledge Management)

### What changed

- `.squad/decisions.md` — Added Decision #4 with 5 CI conventions from
PR #9 Copilot review
- `.squad/decisions/inbox/boromir-pr9-review-fixes.md` — Marked as
merged (tombstone comment)

### Decision #4 covers

1. Always use `global-json-file: global.json` in `setup-dotnet`
2. Use `nuGetVersion` for `/p:Version` in dotnet build (not
`assemblySemVer`)
3. `squad-test.yml` must only trigger on `pull_request`, not `push`
4. Surgical use of `continue-on-error: true`
5. Comments must not contradict the code they describe

These conventions apply to all future workflow files.
mpaulosky added a commit that referenced this pull request Apr 19, 2026
- Replace {PROJECT_NUMBER} placeholder with project 4 (MyBlog)
- Repo linked to https://github.com/users/mpaulosky/projects/4
- Status columns confirmed: Backlog, In Sprint, In Review, Done, Released

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants