当成员为IEnumerable ]时,是否有一种方法可以在使用Mapster进行映射的过程中忽略源中所有空值。 我正在使用Mapster 5.3.1和EF Core 3.1中的DI ...,并且我有一个问题..当两个成员都是IEnumerable并且都具有相同的结构时,是否有一种方法可以在映射期间忽略源成员中的所有空值。 var tSource =(IEnumerable)var tDestination =(IEnumerable) _ mapper.Map(tSource,tDestination) 如果tSource具有空值,我不想在tDestination中使用该值。 希望你们能帮助我。 感谢 我正在将Mapster 5.3.1与EF Core 3.1中的DI一起使用...,我有一个问题..当两个成员都是IEnumerable并且都具有.num时,是否有一种方法可以忽略源成员中的所有空值。 。 您可以使用IgnoreNullVaules忽略null属性。 https://github.com/MapsterMapper/Mapster/wiki/Shallow-merge#copy-vs-merge

问题描述 投票:0回答:1
我正在使用Mapster 5.3.1和EF Core 3.1中的DI ...,并且我有一个问题..当两个成员都是IEnumerable并且都具有相同的结构时,是否有一种方法可以在映射期间忽略源成员中的所有空值。

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

_ mapper.Map(tSource,tDestination)

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

希望你们能帮助我。

感谢

我正在将Mapster 5.3.1与EF Core 3.1中的DI一起使用...,我有一个问题..当两个成员都是IEnumerable并且都具有.num时,是否有一种方法可以忽略源成员中的所有空值。 。

null mapping ienumerable ef-core-3.1 mapster
1个回答
0
投票
您可以使用IgnoreNullVaules忽略null属性。 https://github.com/MapsterMapper/Mapster/wiki/Shallow-merge#copy-vs-merge
© www.soinside.com 2019 - 2024. All rights reserved.