- Umwandlung von AddScoped in TryAddScoped in der Methode AddWorkFlowRepositories. - Methode mit dem Namen AddWorkFlow erstellt, um Dienste und Repositories zusammen hinzuzufügen
25 lines
1.0 KiB
C#
25 lines
1.0 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
using WorkFlow.Application.Contracts;
|
|
using WorkFlow.Application.Services;
|
|
using WorkFlow.Infrastructure;
|
|
|
|
namespace WorkFlow.Application
|
|
{
|
|
public static class DIExtensions
|
|
{
|
|
public static IServiceCollection AddWorkFlowServices(this IServiceCollection services)
|
|
{
|
|
services.AddAutoMapper(typeof(MappingProfile).Assembly);
|
|
services.TryAddScoped<IConfigService, ConfigService>();
|
|
services.TryAddScoped<IProfileControlsTFService, ProfileControlsTFService>();
|
|
services.TryAddScoped<IProfileObjStateService, ProfileObjStateService>();
|
|
services.TryAddScoped<IProfileService, ProfileService>();
|
|
services.TryAddScoped<IStateService, StateService>();
|
|
|
|
return services;
|
|
}
|
|
|
|
public static IServiceCollection AddWorkFlow(this IServiceCollection services) => services.AddWorkFlowRepositories().AddWorkFlowServices();
|
|
}
|
|
} |