I specify mapster service operations in web program.cs in layered architecture, but I want to use this application in another layer. And I'm having trouble choosing assembly.
Web Layer Program.cs
var config = TypeAdapterConfig.GlobalSettings;
config.Scan(Assembly.GetAssembly(typeof(UserMappingConfig)));
builder.Services.AddSingleton(config);
builder.Services.AddScoped<IMapper, ServiceMapper>();
Service Layer Mapping Classes
namespace Exams.Service.Mapping
{
public class QuestionMappingConfig : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.NewConfig<QuestionViewModel, Question>().IgnoreNullValues(true);
config.NewConfig<List<QuestionViewModel>,List<Question>>().IgnoreNullValues(true);
config.NewConfig<Question, QuestionViewModel>().IgnoreNullValues(true);
}
}
}
I am getting a warning like this
Severity Code Description Project File Line Suppression State Warning CS8604 Possible null reference argument for parameter 'assemblies' in 'IList TypeAdapterConfig.Scan(params Assembly[] assemblies)'.
To summarize, for the Mapster application that I have to define in the Web layer, I want to use the configurations that I defined in the Service layer in the Service layer, but I have trouble choosing the assembly. How can I fix?