Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Centralize Uri Creation with UriBuilder Pattern #10662

Closed
marcarro opened this issue Jul 22, 2024 · 0 comments · Fixed by #11346
Closed

Refactor: Centralize Uri Creation with UriBuilder Pattern #10662

marcarro opened this issue Jul 22, 2024 · 0 comments · Fixed by #11346

Comments

@marcarro
Copy link
Contributor

Description

As mentioned in #10578 (comment): throughout the Razor codebase, there's a recurring pattern of using UriBuilder to construct file-schema URIs. It would be useful to create a global helper method for URI creation and update all instances where the UriBuilder pattern is used with this helper method.

Examples

One common usage pattern observed is:

      var newComponentUri = new UriBuilder
      {
          Scheme = Uri.UriSchemeFile,
          Path = updatedComponentPath,
          Host = string.Empty,
      }.Uri;

Proposal

Implement a global helper method, e.g., CreateFileUri(string path), that encapsulates the UriBuilder pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants