last ...
This commit is contained in:
@@ -4,6 +4,8 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using xAiService.Configurations;
|
||||
using xAiService.Constants;
|
||||
using xAiService.Extensions;
|
||||
using xAiService.Interfaces;
|
||||
using xAiService.Services;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
|
||||
@@ -45,30 +47,44 @@ namespace xAiService.DI
|
||||
source.AddSingleton<XAIServiceConfiguration>(configuration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adding XAiService ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="lifeTime"></param>
|
||||
public static void AddXAIService(
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration,
|
||||
ServiceLifetime lifeTime = ServiceLifetime.Singleton
|
||||
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
||||
)
|
||||
{
|
||||
//
|
||||
var config = configuration.GetXAIServiceConfiguration();
|
||||
AddAIService(
|
||||
services,
|
||||
config
|
||||
config,
|
||||
lifeTime
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adding XAiService ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="lifeTime"></param>
|
||||
public static void AddXAIService(
|
||||
this IServiceCollection services,
|
||||
XAIServiceConfiguration configuration,
|
||||
ServiceLifetime lifeTime = ServiceLifetime.Singleton
|
||||
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
||||
)
|
||||
{
|
||||
//
|
||||
AddAIService(
|
||||
services,
|
||||
configuration
|
||||
configuration,
|
||||
lifeTime
|
||||
);
|
||||
}
|
||||
|
||||
@@ -88,6 +104,12 @@ namespace xAiService.DI
|
||||
Console.WriteLine($"{XLogTag} => {message}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adding Ai Service ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="lifeTime"></param>
|
||||
private static void AddAIService(
|
||||
this IServiceCollection services,
|
||||
XAIServiceConfiguration configuration,
|
||||
@@ -145,6 +167,7 @@ namespace xAiService.DI
|
||||
|
||||
//
|
||||
// Register Services ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiService), typeof(XAiService), lifeTime));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user