Skip to content

refactor: make CLI transforms shim-first preserve Web Forms API calls#536

Open
csharpfritz wants to merge 1 commit intoFritzAndFriends:devfrom
csharpfritz:feature/shim-first-transforms
Open

refactor: make CLI transforms shim-first preserve Web Forms API calls#536
csharpfritz wants to merge 1 commit intoFritzAndFriends:devfrom
csharpfritz:feature/shim-first-transforms

Conversation

@csharpfritz
Copy link
Copy Markdown
Collaborator

Shim-First CLI Transforms

WebFormsPageBase provides Request, Response, Server, Session, Cache, ClientScript, IsPostBack, and ViewState as properties. Pages inheriting from it compile AS-IS. But 5 CLI transforms were doing unnecessary work:

  • ResponseRedirectTransform stopped rewriting Response.Redirect() to NavigationManager. ResponseShim handles it.
  • SessionDetectTransform removed redundant [Inject] SessionShim/CacheShim (already on WebFormsPageBase)
  • ClientScriptTransform fixed guidance (was suggesting @Inject in .cs files)
  • RequestFormTransform updated guidance to note automatic shim support
  • ServerShimTransform updated guidance to note automatic shim support

All 353 CLI tests pass.

Closes #534

WebFormsPageBase provides Request, Response, Server, Session, Cache,
ClientScript, IsPostBack, and ViewState as properties. Code inheriting
from it compiles AS-IS with no transforms needed for these APIs.

Changes:
- ResponseRedirectTransform: stop rewriting Response.Redirect() to
  NavigationManager.NavigateTo(). Leave calls intact  ResponseShim
  handles ~/ and .aspx automatically. Only strip Page./this. prefix.
- SessionDetectTransform: remove redundant [Inject] SessionShim and
  CacheShim injection  already on WebFormsPageBase.
- ClientScriptTransform: fix guidance to say 'works via WebFormsPageBase'
  instead of suggesting @Inject (wrong syntax in .cs file).
- RequestFormTransform: lead guidance with 'works automatically via
  RequestShim on WebFormsPageBase'.
- ServerShimTransform: lead guidance with 'works automatically via
  ServerShim on WebFormsPageBase'.

All 353 CLI tests pass.

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.

Consider consolidating page-level base classes (WebFormsPageBase, WebFormsPage, WebFormsForm)

1 participant