Share via


ImageGeneratorBuilderServiceCollectionExtensions.AddImageGenerator Method

Definition

Overloads

AddImageGenerator(IServiceCollection, IImageGenerator, ServiceLifetime)

Source:
ImageGeneratorBuilderServiceCollectionExtensions.cs

Registers a singleton IImageGenerator in the IServiceCollection.

public static Microsoft.Extensions.AI.ImageGeneratorBuilder AddImageGenerator(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, Microsoft.Extensions.AI.IImageGenerator innerGenerator, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime = Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton);
static member AddImageGenerator : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.AI.IImageGenerator * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.Extensions.AI.ImageGeneratorBuilder
<Extension()>
Public Function AddImageGenerator (serviceCollection As IServiceCollection, innerGenerator As IImageGenerator, Optional lifetime As ServiceLifetime = Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton) As ImageGeneratorBuilder

Parameters

serviceCollection
IServiceCollection

The IServiceCollection to which the generator should be added.

innerGenerator
IImageGenerator

The inner IImageGenerator that represents the underlying backend.

lifetime
ServiceLifetime

The service lifetime for the generator. Defaults to Singleton.

Returns

An ImageGeneratorBuilder that can be used to build a pipeline around the inner generator.

Exceptions

serviceCollection or innerGenerator is null.

Remarks

The generator is registered as a singleton service.

Applies to

AddImageGenerator(IServiceCollection, Func<IServiceProvider,IImageGenerator>, ServiceLifetime)

Source:
ImageGeneratorBuilderServiceCollectionExtensions.cs

Registers a singleton IImageGenerator in the IServiceCollection.

public static Microsoft.Extensions.AI.ImageGeneratorBuilder AddImageGenerator(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, Func<IServiceProvider,Microsoft.Extensions.AI.IImageGenerator> innerGeneratorFactory, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime = Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton);
static member AddImageGenerator : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, Microsoft.Extensions.AI.IImageGenerator> * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.Extensions.AI.ImageGeneratorBuilder
<Extension()>
Public Function AddImageGenerator (serviceCollection As IServiceCollection, innerGeneratorFactory As Func(Of IServiceProvider, IImageGenerator), Optional lifetime As ServiceLifetime = Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton) As ImageGeneratorBuilder

Parameters

serviceCollection
IServiceCollection

The IServiceCollection to which the generator should be added.

innerGeneratorFactory
Func<IServiceProvider,IImageGenerator>

A callback that produces the inner IImageGenerator that represents the underlying backend.

lifetime
ServiceLifetime

The service lifetime for the generator. Defaults to Singleton.

Returns

An ImageGeneratorBuilder that can be used to build a pipeline around the inner generator.

Exceptions

serviceCollection or innerGeneratorFactory is null.

Remarks

The generator is registered as a singleton service.

Applies to