wanshenmean
8 天以前 fd18eaba5e1c086a588509371f91310e7aafff9c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using Mapster;
using MapsterMapper;
 
namespace WIDESEAWCS_WCSServer.Filter
{
    /// <summary>
    /// Mapster 启动服务
    /// </summary>
    public static class MapsterSetup
    {
        public static void AddMapsterSetup(this IServiceCollection services)
        {
            if (services == null) throw new ArgumentNullException(nameof(services));
 
            TypeAdapterConfig typeAdapterConfig = new TypeAdapterConfig();
            MapsterConfig.RegisterMappings(typeAdapterConfig);
 
            services.AddSingleton(typeAdapterConfig);
            services.AddScoped<IMapper, ServiceMapper>();
        }
    }
}