Description
Currently F# ignores Extension Startups that are generated (issue #1246) and as a workaround it must be configured manually.
It is easily doable for classic IHostBuilder, because its extension allows to pass configure action:
|
public static IHostBuilder ConfigureFunctionsWebApplication(this IHostBuilder builder, Action<IFunctionsWorkerApplicationBuilder> configureWorker) |
But this is not possible for the new preferred IHostApplicationBuilder as the only extension method does not allow to pass configure action:
|
public static FunctionsApplicationBuilder ConfigureFunctionsWebApplication(this FunctionsApplicationBuilder builder) |
It makes .NET Aspire harder to use, because its entire ServiceDefaults rely on IHostApplicationBuilder and it requires either custom implementation or below hack to access internal HostBuilder property:
let builder = FunctionsApplication.CreateBuilder(args)
let hostBuilder =
builder
.GetType()
.GetProperty(
"HostBuilder",
System.Reflection.BindingFlags.NonPublic
||| System.Reflection.BindingFlags.Instance
)
.GetValue(builder, null)
:?> IHostBuilder
hostBuilder.ConfigureFunctionsWebApplication(fun app -> ServiceBusExtensionStartup().Configure(app))
// .NET Aspire defaults
builder.AddServiceDefaults()
builder.Build().Run()
Description
Currently F# ignores Extension Startups that are generated (issue #1246) and as a workaround it must be configured manually.
It is easily doable for classic
IHostBuilder, because its extension allows to pass configure action:azure-functions-dotnet-worker/extensions/Worker.Extensions.Http.AspNetCore/src/FunctionsHostBuilderExtensions.cs
Line 37 in cfb4d9c
But this is not possible for the new preferred
IHostApplicationBuilderas the only extension method does not allow to pass configure action:azure-functions-dotnet-worker/extensions/Worker.Extensions.Http.AspNetCore/src/FunctionsApplicationBuilderAspNetCoreExtensions.cs
Line 18 in cfb4d9c
It makes .NET Aspire harder to use, because its entire
ServiceDefaultsrely onIHostApplicationBuilderand it requires either custom implementation or below hack to access internalHostBuilderproperty: