refactor: fix MappingConfig to avoid invalid property access and restore using directives
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
using Mapster;
|
||||
using MapsterMapper;
|
||||
using NexusReader.Application.DTOs.User;
|
||||
using NexusReader.Domain.Entities;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Reflection;
|
||||
|
||||
namespace NexusReader.Application.Mappings;
|
||||
|
||||
public static class MappingConfig
|
||||
{
|
||||
public static IServiceCollection AddMapsterConfiguration(this IServiceCollection services)
|
||||
public static void RegisterMappings(this IServiceCollection services)
|
||||
{
|
||||
var config = TypeAdapterConfig.GlobalSettings;
|
||||
|
||||
// Manual registration for AOT (or use Source Generator)
|
||||
// config.NewConfig<Source, Destination>();
|
||||
config.NewConfig<NexusUser, UserProfileDto>();
|
||||
// Roles are mapped manually in queries due to Identity structure
|
||||
|
||||
services.AddSingleton(config);
|
||||
services.AddScoped<IMapper, ServiceMapper>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user