From 3a741787b811d005aaaa09a517ccd3ea5ce89985 Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Mon, 13 Jul 2026 14:46:20 +0500 Subject: [PATCH 01/10] feat: add git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 434416f4..e6d5ee03 100644 --- a/.gitignore +++ b/.gitignore @@ -188,3 +188,4 @@ src/.idea # VS Code settings .vscode/launch.json .vscode/tasks.json +.DS_Store From 58f9f3e334f0c82721bc17bd0a1debaac9983d98 Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Mon, 13 Jul 2026 14:54:18 +0500 Subject: [PATCH 02/10] fix: fix apply Settings to Nullable types --- src/Mapster.Tests/WhenMappingNullablePrimitives.cs | 11 +++++++++++ src/Mapster/TypeAdapterConfig.cs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs index 47aa080d..6ebc55d2 100644 --- a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs +++ b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs @@ -172,6 +172,17 @@ public void CustomConverterWorkWithNullablePrimitiveTypes() } + [TestMethod] + public void NullablePrimitiveTypesCorrectUsageNonNullableSettings() + { + TypeAdapterConfig config = new TypeAdapterConfig(); + config.NewConfig().MapWith(src => Convert.ToInt32(src)); + + long? value = null; + + Should.NotThrow(() => value.Adapt(config) ); + } + #region TestClasses diff --git a/src/Mapster/TypeAdapterConfig.cs b/src/Mapster/TypeAdapterConfig.cs index 9463072b..1d086ea7 100644 --- a/src/Mapster/TypeAdapterConfig.cs +++ b/src/Mapster/TypeAdapterConfig.cs @@ -269,7 +269,7 @@ private static TypeAdapterRule CreateDestinationTypeRule(TypeTuple key) private static int? GetSubclassDistance(Type type1, Type type2, bool allowInheritance) { //Support for using ValueType mapping configurations of types, for mapping cases on Nulllable ValueType values - if (type1.IsNullable() && !type1.ContainsGenericParameters) + if (type2.IsInterface && type1.IsNullable() && !type1.ContainsGenericParameters) type1 = type1.GetGenericArguments().FirstOrDefault(); if (type1 == type2) From 8ba442a865bed4e16e2f9d4632fe62791eaa64b4 Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Mon, 13 Jul 2026 15:14:32 +0500 Subject: [PATCH 03/10] feat(test): add test from #996 case --- .../WhenMappingNullablePrimitives.cs | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs index 6ebc55d2..2bb9c412 100644 --- a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs +++ b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs @@ -178,14 +178,47 @@ public void NullablePrimitiveTypesCorrectUsageNonNullableSettings() TypeAdapterConfig config = new TypeAdapterConfig(); config.NewConfig().MapWith(src => Convert.ToInt32(src)); - long? value = null; + long? value = null; + + Should.NotThrow(() => value.Adapt(config) ); + + } + + [TestMethod] + public void MapNullableValueTypePropertryToNonNullableCorrect() + { + TypeAdapterConfig config = new TypeAdapterConfig(); + config.NewConfig().MapWith(src => Convert.ToInt32(src)); + config.NewConfig() + .Map(dest => dest.IntNonNullable, src => src.LongNullable); + + var src = new PropSrc996 { LongNullable = 42 }; + var result = src.Adapt(config); + + var srcnull = new PropSrc996 { LongNullable = null }; + var resultnull = srcnull.Adapt(config); + + result.IntNonNullable.ShouldBe(42); + resultnull.IntNonNullable.ShouldBe(0); + + Should.Throw(() => new PropSrc996 { LongNullable = long.MaxValue }.Adapt(config)); - Should.NotThrow(() => value.Adapt(config) ); } #region TestClasses + public class PropSrc996 + { + public long? LongNullable { get; set; } + } + + public class PropDest996 + { + public int IntNonNullable { get; set; } + } + + static class Helper992 { public static bool? ParseToNullableBool(string? value) From 3581268f6b0f3a1d1bb3ff37a41be1358c86e6de Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Mon, 13 Jul 2026 15:36:00 +0500 Subject: [PATCH 04/10] feat(test): add Custom Null converter test --- .../WhenMappingNullablePrimitives.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs index 2bb9c412..8667a092 100644 --- a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs +++ b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs @@ -205,6 +205,27 @@ public void MapNullableValueTypePropertryToNonNullableCorrect() } + [TestMethod] + public void CustomNullConverterisWorked() + { + TypeAdapterConfig config = new TypeAdapterConfig(); + config.NewConfig().MapWith(src => src == null ? 996 : Convert.ToInt32(src.Value)); + config.NewConfig() + .Map(dest => dest.IntNonNullable, src => src.LongNullable); + + var src = new PropSrc996 { LongNullable = 42 }; + var result = src.Adapt(config); + + var srcnull = new PropSrc996 { LongNullable = null }; + var resultnull = srcnull.Adapt(config); + + result.IntNonNullable.ShouldBe(42); + resultnull.IntNonNullable.ShouldBe(996); + + Should.Throw(() => new PropSrc996 { LongNullable = long.MaxValue }.Adapt(config)); + + } + #region TestClasses From 9e4aa49ebec53ce4c1a9b7bbd74a006009e9fe75 Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Tue, 14 Jul 2026 15:51:36 +0500 Subject: [PATCH 05/10] fix: CustomConverterNull protection --- .../WhenMappingNullablePrimitives.cs | 36 ++++++++++++++++++- src/Mapster/Adapters/NullableAdapter.cs | 2 ++ src/Mapster/TypeAdapterConfig.cs | 9 ++++- src/Mapster/TypeAdapterSetter.cs | 3 ++ src/Mapster/TypeAdapterSettings.cs | 10 ++++++ 5 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs index 8667a092..51faff7b 100644 --- a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs +++ b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs @@ -226,6 +226,27 @@ public void CustomNullConverterisWorked() } + [TestMethod] + public void ParamNullableProtectionisWork() + { + TypeAdapterConfig config = new TypeAdapterConfig(); + config.ForType().MapWith(src => (long)Helper992.ToSecondsTimestamp(src)); // work only ParseToNullableBool() return not null + + var src = new NullableDateTimeInsaider(){ CreatedAt = null}; + Should.NotThrow(()=> src.Adapt(config)); + } + + public class NullableDateTimeInsaider + { + public DateTime? CreatedAt { get; set; } + } + + public class LongInsaider + { + public long CreatedAt { get; set; } + } + + #region TestClasses @@ -254,13 +275,26 @@ static class Helper992 _ => null }; } + + public static long? ToSecondsTimestamp( DateTime? dateTime) + { + if (dateTime is null) + return null; + + return 42; + } + } public class Source992 { public string? Prop1 { get; set; } } - + public class Destination992NotNull + { + public bool Prop1 { get; set; } + } + public class Destination992 { public bool? Prop1 { get; set; } diff --git a/src/Mapster/Adapters/NullableAdapter.cs b/src/Mapster/Adapters/NullableAdapter.cs index 598a2192..e61d8c66 100644 --- a/src/Mapster/Adapters/NullableAdapter.cs +++ b/src/Mapster/Adapters/NullableAdapter.cs @@ -11,6 +11,8 @@ internal class NullableAdapter : BaseAdapter protected override bool CanMap(PreCompileArgument arg) { + if(arg.ExplicitMapping) + return false; return arg.SourceType.IsNullable() || arg.DestinationType.IsNullable(); } protected override bool CanInline(Expression source, Expression? destination, CompileArgument arg) diff --git a/src/Mapster/TypeAdapterConfig.cs b/src/Mapster/TypeAdapterConfig.cs index 1d086ea7..4f51fb9d 100644 --- a/src/Mapster/TypeAdapterConfig.cs +++ b/src/Mapster/TypeAdapterConfig.cs @@ -447,6 +447,14 @@ private static LambdaExpression CreateMapExpression(CompileArgument arg) private static LambdaExpression AdjustInheritedConverterReturnType(LambdaExpression lambda, CompileArgument arg) { + if(arg.ExplicitMapping && lambda.Parameters[0].Type.CanBeNull()) + { + if(arg.Settings.CustomConverterFactory.GetValueOrDefault() || arg.Settings.CustomToTargetFactory.GetValueOrDefault()) + { + lambda = Expression.Lambda(lambda.Parameters[0].NotNullReturn(lambda.Body),lambda.Parameters); + } + } + var destinationType = arg.DestinationType; var returnType = lambda.ReturnType; var lamdaBody = lambda.Body; @@ -501,7 +509,6 @@ private static LambdaExpression AdjustInheritedConverterReturnType(LambdaExpress } - return Expression.Lambda(body, lambda.Parameters); } diff --git a/src/Mapster/TypeAdapterSetter.cs b/src/Mapster/TypeAdapterSetter.cs index 03c41eeb..1504f4b1 100644 --- a/src/Mapster/TypeAdapterSetter.cs +++ b/src/Mapster/TypeAdapterSetter.cs @@ -733,6 +733,7 @@ public TypeAdapterSetter MapWith(Expression Expression.Lambda(converterFactory.Body, converterFactory.Parameters[0], dest); } } + Settings.CustomConverterFactory = true; return this; } @@ -753,6 +754,8 @@ public TypeAdapterSetter MapToTargetWith(Expression converterFactory; + + Settings.CustomToTargetFactory = true; return this; } diff --git a/src/Mapster/TypeAdapterSettings.cs b/src/Mapster/TypeAdapterSettings.cs index 38e3a53c..5073d9d6 100644 --- a/src/Mapster/TypeAdapterSettings.cs +++ b/src/Mapster/TypeAdapterSettings.cs @@ -181,6 +181,16 @@ public Func? ConverterToTargetFactory get => Get>(nameof(ConverterToTargetFactory)); set => Set(nameof(ConverterToTargetFactory), value); } + public bool? CustomConverterFactory + { + get => Get(nameof(CustomConverterFactory)); + set => Set(nameof(CustomConverterFactory), value); + } + public bool? CustomToTargetFactory + { + get => Get(nameof(CustomToTargetFactory)); + set => Set(nameof(CustomToTargetFactory), value); + } public object? MapToConstructor { get => Get(nameof(MapToConstructor)); From 05f5bd52e7d7d9ca9ba97af90614da14d83579eb Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Tue, 14 Jul 2026 16:14:56 +0500 Subject: [PATCH 06/10] fix: add Null check visitor --- src/Mapster/TypeAdapterConfig.cs | 6 +++- src/Mapster/Utils/NullCheckFinder.cs | 49 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/Mapster/Utils/NullCheckFinder.cs diff --git a/src/Mapster/TypeAdapterConfig.cs b/src/Mapster/TypeAdapterConfig.cs index 4f51fb9d..168a9819 100644 --- a/src/Mapster/TypeAdapterConfig.cs +++ b/src/Mapster/TypeAdapterConfig.cs @@ -451,7 +451,11 @@ private static LambdaExpression AdjustInheritedConverterReturnType(LambdaExpress { if(arg.Settings.CustomConverterFactory.GetValueOrDefault() || arg.Settings.CustomToTargetFactory.GetValueOrDefault()) { - lambda = Expression.Lambda(lambda.Parameters[0].NotNullReturn(lambda.Body),lambda.Parameters); + var check = new NullCheckFinder(lambda.Parameters[0]); + check.Visit(lambda.Body); + + if(!check.FoundNullCheck) + lambda = Expression.Lambda(lambda.Parameters[0].NotNullReturn(lambda.Body),lambda.Parameters); } } diff --git a/src/Mapster/Utils/NullCheckFinder.cs b/src/Mapster/Utils/NullCheckFinder.cs new file mode 100644 index 00000000..ae1d302f --- /dev/null +++ b/src/Mapster/Utils/NullCheckFinder.cs @@ -0,0 +1,49 @@ +using System; +using System.Linq.Expressions; + +public class NullCheckFinder : ExpressionVisitor +{ + private readonly ParameterExpression _targetParameter; + public bool FoundNullCheck { get; private set; } + + public NullCheckFinder(ParameterExpression targetParameter) + { + _targetParameter = targetParameter ?? throw new ArgumentNullException(nameof(targetParameter)); + FoundNullCheck = false; + } + + protected override Expression VisitBinary(BinaryExpression node) + { + + if (node.NodeType == ExpressionType.Equal || node.NodeType == ExpressionType.NotEqual) + { + + var isLeftTarget = IsSameParameter(node.Left); + var isRightTarget = IsSameParameter(node.Right); + + + var otherSideIsNull = + (!isLeftTarget && IsNullConstant(node.Left)) || + (!isRightTarget && IsNullConstant(node.Right)); + + if ((isLeftTarget || isRightTarget) && otherSideIsNull) + { + FoundNullCheck = true; + + return node; + } + } + + return base.VisitBinary(node); + } + + private bool IsSameParameter(Expression exp) + { + return exp is ParameterExpression param && param == _targetParameter; + } + + private static bool IsNullConstant(Expression exp) + { + return exp is ConstantExpression c && c.Value == null; + } +} \ No newline at end of file From 93319f91c588362fe454f8afe174726276d82d33 Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Wed, 15 Jul 2026 09:57:57 +0500 Subject: [PATCH 07/10] feat: Refactoring ApplyNullPropagation to CustomConverterFactory --- .../WhenMappingNullablePrimitives.cs | 3 +- src/Mapster/TypeAdapterConfig.cs | 16 +++------ src/Mapster/TypeAdapterSetter.cs | 33 ++++++++++++++++--- src/Mapster/TypeAdapterSettings.cs | 11 ++----- 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs index 51faff7b..ff5711e2 100644 --- a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs +++ b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs @@ -227,9 +227,10 @@ public void CustomNullConverterisWorked() } [TestMethod] - public void ParamNullableProtectionisWork() + public void ApplyNullPropagationToCustomConverterWorked() { TypeAdapterConfig config = new TypeAdapterConfig(); + config.ActivateCustomConvertersSrcNullPropagation = true; config.ForType().MapWith(src => (long)Helper992.ToSecondsTimestamp(src)); // work only ParseToNullableBool() return not null var src = new NullableDateTimeInsaider(){ CreatedAt = null}; diff --git a/src/Mapster/TypeAdapterConfig.cs b/src/Mapster/TypeAdapterConfig.cs index 168a9819..e5a4a44a 100644 --- a/src/Mapster/TypeAdapterConfig.cs +++ b/src/Mapster/TypeAdapterConfig.cs @@ -89,6 +89,7 @@ private static List CreateRuleTemplate() public bool AllowImplicitDestinationInheritance { get; set; } public bool AllowImplicitSourceInheritance { get; set; } = true; public bool SelfContainedCodeGeneration { get; set; } + public bool ActivateCustomConvertersSrcNullPropagation { get; set; } = false; public Func Compiler { get; set; } = lambda => lambda.Compile(); @@ -447,17 +448,10 @@ private static LambdaExpression CreateMapExpression(CompileArgument arg) private static LambdaExpression AdjustInheritedConverterReturnType(LambdaExpression lambda, CompileArgument arg) { - if(arg.ExplicitMapping && lambda.Parameters[0].Type.CanBeNull()) - { - if(arg.Settings.CustomConverterFactory.GetValueOrDefault() || arg.Settings.CustomToTargetFactory.GetValueOrDefault()) - { - var check = new NullCheckFinder(lambda.Parameters[0]); - check.Visit(lambda.Body); - - if(!check.FoundNullCheck) - lambda = Expression.Lambda(lambda.Parameters[0].NotNullReturn(lambda.Body),lambda.Parameters); - } - } + + if(arg.Settings.ApplyCustomConverterFactoryNullPropagation.GetValueOrDefault()) + lambda = Expression.Lambda(lambda.Parameters[0].NotNullReturn(lambda.Body),lambda.Parameters); + var destinationType = arg.DestinationType; var returnType = lambda.ReturnType; diff --git a/src/Mapster/TypeAdapterSetter.cs b/src/Mapster/TypeAdapterSetter.cs index 1504f4b1..c2da655a 100644 --- a/src/Mapster/TypeAdapterSetter.cs +++ b/src/Mapster/TypeAdapterSetter.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Linq.Expressions; using System.Reflection; +using System.Runtime.CompilerServices; namespace Mapster { @@ -714,7 +715,8 @@ public TypeAdapterSetter ConstructUsing(Expression MapWith(Expression> converterFactory, bool applySettings = false) + public TypeAdapterSetter MapWith(Expression> converterFactory, bool applySettings = false, + bool disableCustomConvertersSrcNullPropagation = false) { this.CheckCompiled(); @@ -733,12 +735,25 @@ public TypeAdapterSetter MapWith(Expression Expression.Lambda(converterFactory.Body, converterFactory.Parameters[0], dest); } } - Settings.CustomConverterFactory = true; + + if(converterFactory.Parameters[0].Type.CanBeNull() + && Config.ActivateCustomConvertersSrcNullPropagation + && !disableCustomConvertersSrcNullPropagation) + { + var check = new NullCheckFinder(converterFactory.Parameters[0]); + check.Visit(converterFactory.Body); + + if (!check.FoundNullCheck) + Settings.ApplyCustomConverterFactoryNullPropagation = true; + } + + return this; } - public TypeAdapterSetter MapToTargetWith(Expression> converterFactory, bool applySettings = false) + public TypeAdapterSetter MapToTargetWith(Expression> converterFactory, bool applySettings = false, + bool disableCustomConvertersSrcNullPropagation = false) { this.CheckCompiled(); @@ -755,7 +770,17 @@ public TypeAdapterSetter MapToTargetWith(Expression converterFactory; - Settings.CustomToTargetFactory = true; + if (converterFactory.Parameters[0].Type.CanBeNull() + && Config.ActivateCustomConvertersSrcNullPropagation + && !disableCustomConvertersSrcNullPropagation) + { + var check = new NullCheckFinder(converterFactory.Parameters[0]); + check.Visit(converterFactory.Body); + + if (!check.FoundNullCheck) + Settings.ApplyCustomConverterFactoryNullPropagation = true; + } + return this; } diff --git a/src/Mapster/TypeAdapterSettings.cs b/src/Mapster/TypeAdapterSettings.cs index 5073d9d6..65f8b6e4 100644 --- a/src/Mapster/TypeAdapterSettings.cs +++ b/src/Mapster/TypeAdapterSettings.cs @@ -181,15 +181,10 @@ public Func? ConverterToTargetFactory get => Get>(nameof(ConverterToTargetFactory)); set => Set(nameof(ConverterToTargetFactory), value); } - public bool? CustomConverterFactory + public bool? ApplyCustomConverterFactoryNullPropagation { - get => Get(nameof(CustomConverterFactory)); - set => Set(nameof(CustomConverterFactory), value); - } - public bool? CustomToTargetFactory - { - get => Get(nameof(CustomToTargetFactory)); - set => Set(nameof(CustomToTargetFactory), value); + get => Get(nameof(ApplyCustomConverterFactoryNullPropagation)); + set => Set(nameof(ApplyCustomConverterFactoryNullPropagation), value); } public object? MapToConstructor { From a6660f4e43dc0363fdd891ef58eb754857fecfcb Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Wed, 15 Jul 2026 11:35:12 +0500 Subject: [PATCH 08/10] feat: clean up --- src/Mapster/TypeAdapterConfig.cs | 3 +-- src/Mapster/TypeAdapterSetter.cs | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Mapster/TypeAdapterConfig.cs b/src/Mapster/TypeAdapterConfig.cs index e5a4a44a..08db194a 100644 --- a/src/Mapster/TypeAdapterConfig.cs +++ b/src/Mapster/TypeAdapterConfig.cs @@ -451,8 +451,7 @@ private static LambdaExpression AdjustInheritedConverterReturnType(LambdaExpress if(arg.Settings.ApplyCustomConverterFactoryNullPropagation.GetValueOrDefault()) lambda = Expression.Lambda(lambda.Parameters[0].NotNullReturn(lambda.Body),lambda.Parameters); - - + var destinationType = arg.DestinationType; var returnType = lambda.ReturnType; var lamdaBody = lambda.Body; diff --git a/src/Mapster/TypeAdapterSetter.cs b/src/Mapster/TypeAdapterSetter.cs index c2da655a..7a78af01 100644 --- a/src/Mapster/TypeAdapterSetter.cs +++ b/src/Mapster/TypeAdapterSetter.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Linq.Expressions; using System.Reflection; -using System.Runtime.CompilerServices; namespace Mapster { @@ -747,8 +746,6 @@ public TypeAdapterSetter MapWith(Expression Date: Wed, 15 Jul 2026 11:33:07 +0300 Subject: [PATCH 09/10] fix: drop not using --- src/Mapster/Adapters/NullableAdapter.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/Mapster/Adapters/NullableAdapter.cs b/src/Mapster/Adapters/NullableAdapter.cs index e61d8c66..178c3266 100644 --- a/src/Mapster/Adapters/NullableAdapter.cs +++ b/src/Mapster/Adapters/NullableAdapter.cs @@ -22,22 +22,6 @@ protected override bool CanInline(Expression source, Expression? destination, Co protected override Expression? CreateInlineExpression(Expression source, CompileArgument arg, bool IsRequiredOnly = false) { - if (arg.ExplicitMapping) - { - LambdaExpression? Convert = null; - - TypeAdapterRule? getsettings; - arg.Context.Config.RuleMap.TryGetValue(new TypeTuple(arg.SourceType, arg.DestinationType), out getsettings); - - if (getsettings != null) - if (arg.MapType == MapType.MapToTarget) - Convert = getsettings.Settings.ConverterToTargetFactory(arg); - else - Convert = getsettings.Settings.ConverterFactory(arg); - if (Convert != null) - return Convert.Apply(arg.MapType, source); - } - var _source = source.Type.IsNullable() ? Expression.Convert(source, source.Type.GetGenericArguments()[0]) : source; From 272295f3dc876db2e72aad703cfb793539c43850 Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Wed, 15 Jul 2026 11:35:21 +0300 Subject: [PATCH 10/10] fix: remove clases --- src/Mapster.Tests/WhenMappingNullablePrimitives.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs index ff5711e2..bd7e3fcd 100644 --- a/src/Mapster.Tests/WhenMappingNullablePrimitives.cs +++ b/src/Mapster.Tests/WhenMappingNullablePrimitives.cs @@ -237,20 +237,19 @@ public void ApplyNullPropagationToCustomConverterWorked() Should.NotThrow(()=> src.Adapt(config)); } + + #region TestClasses + public class NullableDateTimeInsaider { public DateTime? CreatedAt { get; set; } } - public class LongInsaider + public class LongInsaider { public long CreatedAt { get; set; } } - - - #region TestClasses - public class PropSrc996 { public long? LongNullable { get; set; }