0

我在EF Core 3.1中使用带有DI的Mapster 5.3.1 ...我有一个问题..当两个成员都是IEnumerable并且都具有相同的结构时,有没有办法在映射期间忽略源成员中的所有空值。

var tSource = (IEnumerable) var tDestination = (IEnumerable)

_mapper.Map(tSource, tDestination)

如果 tSource 有一个空值,我不想在 tDestination 中使用该值。

我希望你们能帮助我。

谢谢

4

1 回答 1

0

您可以使用 忽略 null 属性IgnoreNullVauleshttps://github.com/MapsterMapper/Mapster/wiki/Shallow-merge#copy-vs-merge

于 2020-05-15T13:59:30.120 回答