Add implicit DI feature for out-of-proc worker (#523)
This commit is contained in:
Родитель
5f05f0ad00
Коммит
3607ab87c4
|
@ -19,7 +19,6 @@ namespace Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfP
|
|||
{
|
||||
var host = new HostBuilder()
|
||||
.ConfigureFunctionsWorkerDefaults(worker => worker.UseNewtonsoftJson())
|
||||
.ConfigureOpenApi()
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddSingleton<Fixture>(new Fixture())
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
using Microsoft.Azure.Functions.Worker.Core;
|
||||
using Microsoft.Azure.Functions.Worker.Extensions.OpenApi;
|
||||
using Microsoft.Azure.Functions.Worker.Extensions.OpenApi.Functions;
|
||||
using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Abstractions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
[assembly: WorkerExtensionStartup(typeof(OpenApiWorkerStartup))]
|
||||
|
||||
namespace Microsoft.Azure.Functions.Worker.Extensions.OpenApi
|
||||
{
|
||||
/// <summary>
|
||||
/// This represents the startup entity for OpenAPI endpoints registration
|
||||
/// </summary>
|
||||
public class OpenApiWorkerStartup : WorkerExtensionStartup
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void Configure(IFunctionsWorkerApplicationBuilder applicationBuilder)
|
||||
{
|
||||
applicationBuilder.Services.AddSingleton<IOpenApiHttpTriggerContext, OpenApiHttpTriggerContext>();
|
||||
applicationBuilder.Services.AddSingleton<IOpenApiTriggerFunction, OpenApiTriggerFunction>();
|
||||
//applicationBuilder.Services.AddSingleton<DefaultOpenApiHttpTrigger, DefaultOpenApiHttpTrigger>();
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче