OpenApiDocumentTransformerContext.ApplicationServices Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the application services associated with the current document.
public IServiceProvider ApplicationServices { get; init; }
member this.ApplicationServices : IServiceProvider with get, set
Public Property ApplicationServices As IServiceProvider
Property Value
Examples
var myService = context.ApplicationServices.GetRequiredService<MyService>();
Remarks
This is the IServiceProvider used when generating the OpenAPI document and can be used to resolve application services within a document transformer. It is typically a scoped provider, such as HttpContext.RequestServices or a scope created specifically for document generation, but the exact lifetime of resolved services depends on how the OpenAPI document generation was invoked.