我想创建一个基于某些条件动态返回 yaml 文件的 asp.net 核心 ViewComponent:例如
namespace MyNameSpace {
[ViewComponent(Name = nameof(MyViewComponent))]
public class MyViewComponent : ViewComponent
{
public async Task<IViewComponentResult> InvokeAsync(object input)
{
string yamlDocument = GetYamlDocumentByInput(input);
//how to proceed here so that my yamlDocument is returned with the right content type?
return View(..., yamlDocument);
}
}}