ImageGeneratorBuilderServiceCollectionExtensions.AddImageGenerator Method
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.
Overloads
| AddImageGenerator(IServiceCollection, IImageGenerator, ServiceLifetime) |
Registers a singleton IImageGenerator in the IServiceCollection. |
| AddImageGenerator(IServiceCollection, Func<IServiceProvider,IImageGenerator>, ServiceLifetime) |
Registers a singleton IImageGenerator in the IServiceCollection. |
AddImageGenerator(IServiceCollection, IImageGenerator, ServiceLifetime)
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)
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.