private static ComputerVisionClient CreateComputerVisionClient(AzureAIOptions options) { ComputerVisionClient computerVision = new ComputerVisionClient( new ApiKeyServiceClientCredentials(options.SubscriptionKey), new System.Net.Http.DelegatingHandler[] { }); computerVision.Endpoint = options.Endpoint; return(computerVision); }
public static IServiceCollection AddAzureAI( this IServiceCollection services, AzureAIOptions options) { services.AddSingleton <AzureComputerVision>(); Func <ComputerVisionClient> factory = () => CreateComputerVisionClient(options); services.AddSingleton(factory); return(services); }