|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Razor.Language.Components;
using Microsoft.CodeAnalysis;
namespace Microsoft.AspNetCore.Razor.Language.TagHelpers.Producers;
internal sealed partial class KeyTagHelperProducer
{
public sealed class Factory : FactoryBase
{
public override bool TryCreate(
Compilation compilation,
bool includeDocumentation,
bool excludeHidden,
[NotNullWhen(true)] out TagHelperProducer? result)
{
if (!compilation.TryGetTypeByMetadataName(ComponentsApi.RenderTreeBuilder.FullTypeName, out var renderTreeBuilderType))
{
// If we can't find RenderTreeBuilder, then just bail. We won't be able to compile the generated code anyway.
result = null;
return false;
}
result = new KeyTagHelperProducer(renderTreeBuilderType);
return true;
}
}
}
|