refactor(DependencyInjection): update mediatRLicense to use from inputs
This commit is contained in:
parent
c952df5bb4
commit
eafdc17b70
@ -47,7 +47,7 @@ try
|
||||
?? throw new InvalidOperationException(
|
||||
"The 'MediatRLicense' configuration value is missing or empty." +
|
||||
"Please ensure it is properly set in the configuration source.");
|
||||
builder.Services.AddWorkFlowServices(opt => opt.MediatRLicense = mediatRLicense).AddWorkFlowRepositories();
|
||||
builder.Services.AddWorkFlowServices(mediatRLicense).AddWorkFlowRepositories();
|
||||
|
||||
builder.Services.AddUserManager<WFDBContext>();
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace WorkFlow.Application;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
public static IServiceCollection AddWorkFlowServices(this IServiceCollection services, Action<WorkFlowServiceOptions>? options = null)
|
||||
public static IServiceCollection AddWorkFlowServices(this IServiceCollection services, string mediatRLicense, Action<WorkFlowServiceOptions>? options = null)
|
||||
{
|
||||
WorkFlowServiceOptions diOptions = new();
|
||||
options?.Invoke(diOptions);
|
||||
@ -14,7 +14,7 @@ public static class DependencyInjection
|
||||
services.AddMediatR(cfg =>
|
||||
{
|
||||
cfg.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly);
|
||||
cfg.LicenseKey = diOptions.MediatRLicense;
|
||||
cfg.LicenseKey = mediatRLicense;
|
||||
});
|
||||
|
||||
services.AddSingleton(diOptions.UriBuilderFactory());
|
||||
@ -25,8 +25,6 @@ public static class DependencyInjection
|
||||
|
||||
public class WorkFlowServiceOptions
|
||||
{
|
||||
public string MediatRLicense { get; set; } = string.Empty;
|
||||
|
||||
public Func<UriBuilder> UriBuilderFactory { get; set; } = () => new UriBuilder();
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,6 @@ public class MappingProfile : AutoMapper.Profile
|
||||
|
||||
CreateMap<TfFile, TfFileDto>()
|
||||
.ForMember(dest => dest.Url, opt => opt.MapFrom<TfFileUriBuilderResolver>())
|
||||
.ForMember(dest => dest.Url, opt => opt.MapFrom<TfFileIconUriBuilderResolver>());
|
||||
.ForMember(dest => dest.IconUrl, opt => opt.MapFrom<TfFileIconUriBuilderResolver>());
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user