| | |
| | | namespace WIDESEAWCS_WCSServer.Filter |
| | | using Mapster; |
| | | using MapsterMapper; |
| | | |
| | | namespace WIDESEAWCS_WCSServer.Filter |
| | | { |
| | | /// <summary> |
| | | /// Automapper 启动服务 |
| | | /// Mapster 启动服务 |
| | | /// </summary> |
| | | public static class AutoMapperSetup |
| | | public static class MapsterSetup |
| | | { |
| | | public static void AddAutoMapperSetup(this IServiceCollection services) |
| | | public static void AddMapsterSetup(this IServiceCollection services) |
| | | { |
| | | if (services == null) throw new ArgumentNullException(nameof(services)); |
| | | |
| | | services.AddAutoMapper(typeof(AutoMapperConfig)); |
| | | AutoMapperConfig.RegisterMappings(); |
| | | TypeAdapterConfig typeAdapterConfig = new TypeAdapterConfig(); |
| | | MapsterConfig.RegisterMappings(typeAdapterConfig); |
| | | |
| | | services.AddSingleton(typeAdapterConfig); |
| | | services.AddScoped<IMapper, ServiceMapper>(); |
| | | } |
| | | } |
| | | } |