-
Notifications
You must be signed in to change notification settings - Fork 233
Description
I would like to create small static extension methods that allow me to utilize razor markup syntax. This was best summarized by Damian in a different thread, so I will quote him here.
Is it fair to summarize this as supporting a new kind of .razor file template that produces a static class rather than a component type, and within it only a
@codeblock containing static methods (using Razor syntax or otherwise) would be allowed? Perhaps by a new@staticdirective that is mutually exclusive with other directives that assume a non-static type (e.g.@inherits,@inject, etc.):@static @code { extension(ComponentFactoryCollection componentFactories) { public void AddMyOtherComponentStub() { @<div class="my-stubbed-component"> @parameters.Get(x => x.ChildContent) </div>) } } }
My personal preference would be to omit the @code { } ceremony and just assume your creating static methods, but I'll let you guys figure out those details.
Original feature request and my motivation are in the ASP.NET Core Roadmap discussion.
dotnet/aspnetcore#64788 (comment)