diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/CircularReferenceMapperTest.SnapshotGeneratedSource.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/CircularReferenceMapperTest.SnapshotGeneratedSource.verified.cs index 203e6f9afa7..44a0ebcddb3 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/CircularReferenceMapperTest.SnapshotGeneratedSource.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/CircularReferenceMapperTest.SnapshotGeneratedSource.verified.cs @@ -15,12 +15,12 @@ public static partial class CircularReferenceMapper return existingTargetReference; var target = new global::Riok.Mapperly.IntegrationTests.Dto.CircularReferenceDto(); refHandler.SetReference(source, target); - if (source.Parent != null) + if (source.Parent is { } sourceParent) { - target.Parent = MapToCircularReferenceDto(source.Parent, refHandler); + target.Parent = MapToCircularReferenceDto(sourceParent, refHandler); } target.Value = source.Value; return target; } } -} \ No newline at end of file +} diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/DeepCloningMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/DeepCloningMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs index 18bc0c942bb..4cbc26f367a 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/DeepCloningMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/DeepCloningMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs @@ -18,37 +18,37 @@ public static partial class DeepCloningMapper IntInitOnlyValue = src.IntInitOnlyValue, RequiredValue = src.RequiredValue, }; - if (src.NullableFlattening != null) + if (src.NullableFlattening is { } srcNullableFlattening) { - target.NullableFlattening = Copy(src.NullableFlattening); + target.NullableFlattening = Copy(srcNullableFlattening); } - if (src.NestedNullable != null) + if (src.NestedNullable is { } srcNestedNullable) { - target.NestedNullable = MapToTestObjectNested(src.NestedNullable); + target.NestedNullable = MapToTestObjectNested(srcNestedNullable); } - if (src.NestedNullableTargetNotNullable != null) + if (src.NestedNullableTargetNotNullable is { } srcNestedNullableTargetNotNullable) { - target.NestedNullableTargetNotNullable = MapToTestObjectNested(src.NestedNullableTargetNotNullable); + target.NestedNullableTargetNotNullable = MapToTestObjectNested(srcNestedNullableTargetNotNullable); } - if (src.TupleValue != null) + if (src.TupleValue is { } srcTupleValue) { - target.TupleValue = MapToValueTuple(src.TupleValue.Value); + target.TupleValue = MapToValueTuple(srcTupleValue); } - if (src.RecursiveObject != null) + if (src.RecursiveObject is { } srcRecursiveObject) { - target.RecursiveObject = Copy(src.RecursiveObject); + target.RecursiveObject = Copy(srcRecursiveObject); } - if (src.SourceTargetSameObjectType != null) + if (src.SourceTargetSameObjectType is { } srcSourceTargetSameObjectType) { - target.SourceTargetSameObjectType = Copy(src.SourceTargetSameObjectType); + target.SourceTargetSameObjectType = Copy(srcSourceTargetSameObjectType); } - if (src.NullableReadOnlyObjectCollection != null) + if (src.NullableReadOnlyObjectCollection is { } srcNullableReadOnlyObjectCollection) { - target.NullableReadOnlyObjectCollection = MapToIReadOnlyCollection(src.NullableReadOnlyObjectCollection); + target.NullableReadOnlyObjectCollection = MapToIReadOnlyCollection(srcNullableReadOnlyObjectCollection); } - if (src.SubObject != null) + if (src.SubObject is { } srcSubObject) { - target.SubObject = MapToInheritanceSubObject(src.SubObject); + target.SubObject = MapToInheritanceSubObject(srcSubObject); } target.IntValue = src.IntValue; target.StringValue = src.StringValue; @@ -133,4 +133,4 @@ private static (string A, string) MapToValueTuple((string A, string) source) return target; } } -} \ No newline at end of file +} diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET8_0.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET8_0.verified.cs index 1d345352d60..04296b3f150 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET8_0.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/MapperTest.SnapshotGeneratedSource_NET8_0.verified.cs @@ -51,43 +51,43 @@ public partial int ParseableInt(string value) IntInitOnlyValue = DirectInt(testObject.IntInitOnlyValue), RequiredValue = DirectInt(testObject.RequiredValue), }; - if (testObject.NullableFlattening != null) + if (testObject.NullableFlattening is { } testObjectNullableFlattening) { - target.NullableFlatteningIdValue = CastIntNullable(testObject.NullableFlattening.IdValue); + target.NullableFlatteningIdValue = CastIntNullable(testObjectNullableFlattening.IdValue); } - if (testObject.NullableUnflatteningIdValue != null) + if (testObject.NullableUnflatteningIdValue is { } testObjectNullableUnflatteningIdValue) { target.NullableUnflattening ??= new(); - target.NullableUnflattening.IdValue = DirectInt(testObject.NullableUnflatteningIdValue.Value); + target.NullableUnflattening.IdValue = DirectInt(testObjectNullableUnflatteningIdValue); } - if (testObject.NestedNullable != null) + if (testObject.NestedNullable is { } testObjectNestedNullable) { - target.NestedNullableIntValue = DirectInt(testObject.NestedNullable.IntValue); - target.NestedNullable = MapToTestObjectNestedDto(testObject.NestedNullable); + target.NestedNullableIntValue = DirectInt(testObjectNestedNullable.IntValue); + target.NestedNullable = MapToTestObjectNestedDto(testObjectNestedNullable); } - if (testObject.NestedNullableTargetNotNullable != null) + if (testObject.NestedNullableTargetNotNullable is { } testObjectNestedNullableTargetNotNullable) { - target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(testObject.NestedNullableTargetNotNullable); + target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(testObjectNestedNullableTargetNotNullable); } - if (testObject.StringNullableTargetNotNullable != null) + if (testObject.StringNullableTargetNotNullable is { } testObjectStringNullableTargetNotNullable) { - target.StringNullableTargetNotNullable = testObject.StringNullableTargetNotNullable; + target.StringNullableTargetNotNullable = testObjectStringNullableTargetNotNullable; } - if (testObject.TupleValue != null) + if (testObject.TupleValue is { } testObjectTupleValue) { - target.TupleValue = MapToValueTuple(testObject.TupleValue.Value); + target.TupleValue = MapToValueTuple(testObjectTupleValue); } - if (testObject.RecursiveObject != null) + if (testObject.RecursiveObject is { } testObjectRecursiveObject) { - target.RecursiveObject = MapToDto(testObject.RecursiveObject); + target.RecursiveObject = MapToDto(testObjectRecursiveObject); } - if (testObject.NullableReadOnlyObjectCollection != null) + if (testObject.NullableReadOnlyObjectCollection is { } testObjectNullableReadOnlyObjectCollection) { - target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(testObject.NullableReadOnlyObjectCollection); + target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(testObjectNullableReadOnlyObjectCollection); } - if (testObject.SubObject != null) + if (testObject.SubObject is { } testObjectSubObject) { - target.SubObject = MapToInheritanceSubObjectDto(testObject.SubObject); + target.SubObject = MapToInheritanceSubObjectDto(testObjectSubObject); } target.IntValue = DirectInt(testObject.IntValue); target.StringValue = testObject.StringValue; @@ -148,29 +148,29 @@ public partial int ParseableInt(string value) IntInitOnlyValue = DirectInt(dto.IntInitOnlyValue), RequiredValue = DirectInt(dto.RequiredValue), }; - if (dto.NullableUnflattening != null) + if (dto.NullableUnflattening is { } dtoNullableUnflattening) { - target.NullableUnflatteningIdValue = CastIntNullable(dto.NullableUnflattening.IdValue); + target.NullableUnflatteningIdValue = CastIntNullable(dtoNullableUnflattening.IdValue); } - if (dto.NestedNullable != null) + if (dto.NestedNullable is { } dtoNestedNullable) { - target.NestedNullable = MapToTestObjectNested(dto.NestedNullable); + target.NestedNullable = MapToTestObjectNested(dtoNestedNullable); } - if (dto.TupleValue != null) + if (dto.TupleValue is { } dtoTupleValue) { - target.TupleValue = MapToValueTuple1(dto.TupleValue.Value); + target.TupleValue = MapToValueTuple1(dtoTupleValue); } - if (dto.RecursiveObject != null) + if (dto.RecursiveObject is { } dtoRecursiveObject) { - target.RecursiveObject = MapFromDto(dto.RecursiveObject); + target.RecursiveObject = MapFromDto(dtoRecursiveObject); } - if (dto.NullableReadOnlyObjectCollection != null) + if (dto.NullableReadOnlyObjectCollection is { } dtoNullableReadOnlyObjectCollection) { - target.NullableReadOnlyObjectCollection = MapToIReadOnlyCollection(dto.NullableReadOnlyObjectCollection); + target.NullableReadOnlyObjectCollection = MapToIReadOnlyCollection(dtoNullableReadOnlyObjectCollection); } - if (dto.SubObject != null) + if (dto.SubObject is { } dtoSubObject) { - target.SubObject = MapToInheritanceSubObject(dto.SubObject); + target.SubObject = MapToInheritanceSubObject(dtoSubObject); } target.IntValue = DirectInt(dto.IntValue); target.StringValue = dto.StringValue; @@ -223,38 +223,38 @@ public partial int ParseableInt(string value) public partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Models.TestObject source, global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto target) { - if (source.NullableFlattening != null) + if (source.NullableFlattening is { } sourceNullableFlattening) { - target.NullableFlatteningIdValue = CastIntNullable(source.NullableFlattening.IdValue); + target.NullableFlatteningIdValue = CastIntNullable(sourceNullableFlattening.IdValue); } - if (source.NestedNullable != null) + if (source.NestedNullable is { } sourceNestedNullable) { - target.NestedNullableIntValue = DirectInt(source.NestedNullable.IntValue); - target.NestedNullable = MapToTestObjectNestedDto(source.NestedNullable); + target.NestedNullableIntValue = DirectInt(sourceNestedNullable.IntValue); + target.NestedNullable = MapToTestObjectNestedDto(sourceNestedNullable); } - if (source.NestedNullableTargetNotNullable != null) + if (source.NestedNullableTargetNotNullable is { } sourceNestedNullableTargetNotNullable) { - target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(source.NestedNullableTargetNotNullable); + target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(sourceNestedNullableTargetNotNullable); } - if (source.StringNullableTargetNotNullable != null) + if (source.StringNullableTargetNotNullable is { } sourceStringNullableTargetNotNullable) { - target.StringNullableTargetNotNullable = source.StringNullableTargetNotNullable; + target.StringNullableTargetNotNullable = sourceStringNullableTargetNotNullable; } - if (source.TupleValue != null) + if (source.TupleValue is { } sourceTupleValue) { - target.TupleValue = MapToValueTuple(source.TupleValue.Value); + target.TupleValue = MapToValueTuple(sourceTupleValue); } - if (source.RecursiveObject != null) + if (source.RecursiveObject is { } sourceRecursiveObject) { - target.RecursiveObject = MapToDto(source.RecursiveObject); + target.RecursiveObject = MapToDto(sourceRecursiveObject); } - if (source.NullableReadOnlyObjectCollection != null) + if (source.NullableReadOnlyObjectCollection is { } sourceNullableReadOnlyObjectCollection) { - target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(source.NullableReadOnlyObjectCollection); + target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(sourceNullableReadOnlyObjectCollection); } - if (source.SubObject != null) + if (source.SubObject is { } sourceSubObject) { - target.SubObject = MapToInheritanceSubObjectDto(source.SubObject); + target.SubObject = MapToInheritanceSubObjectDto(sourceSubObject); } target.CtorValue = DirectInt(source.CtorValue); target.CtorValue2 = DirectInt(source.CtorValue2); @@ -482,4 +482,4 @@ static file class UnsafeAccessor [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_PrivateValue")] public static extern void SetPrivateValue1(this global::Riok.Mapperly.IntegrationTests.Models.TestObject target, int value); } -} \ No newline at end of file +} diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs index 89eb70cbbed..359be593576 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs @@ -73,26 +73,26 @@ public static partial class ProjectionMapper IntInitOnlyValue = testObject.IntInitOnlyValue, RequiredValue = testObject.RequiredValue, }; - if (testObject.NestedNullable != null) + if (testObject.NestedNullable is { } testObjectNestedNullable) { - target.NestedNullableIntValue = testObject.NestedNullable.IntValue; - target.NestedNullable = MapToTestObjectNestedDto(testObject.NestedNullable); + target.NestedNullableIntValue = testObjectNestedNullable.IntValue; + target.NestedNullable = MapToTestObjectNestedDto(testObjectNestedNullable); } - if (testObject.NestedNullableTargetNotNullable != null) + if (testObject.NestedNullableTargetNotNullable is { } testObjectNestedNullableTargetNotNullable) { - target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(testObject.NestedNullableTargetNotNullable); + target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(testObjectNestedNullableTargetNotNullable); } - if (testObject.StringNullableTargetNotNullable != null) + if (testObject.StringNullableTargetNotNullable is { } testObjectStringNullableTargetNotNullable) { - target.StringNullableTargetNotNullable = testObject.StringNullableTargetNotNullable; + target.StringNullableTargetNotNullable = testObjectStringNullableTargetNotNullable; } - if (testObject.NullableReadOnlyObjectCollection != null) + if (testObject.NullableReadOnlyObjectCollection is { } testObjectNullableReadOnlyObjectCollection) { - target.NullableReadOnlyObjectCollection = MapToIReadOnlyCollection(testObject.NullableReadOnlyObjectCollection); + target.NullableReadOnlyObjectCollection = MapToIReadOnlyCollection(testObjectNullableReadOnlyObjectCollection); } - if (testObject.SubObject != null) + if (testObject.SubObject is { } testObjectSubObject) { - target.SubObject = MapToInheritanceSubObjectDto(testObject.SubObject); + target.SubObject = MapToInheritanceSubObjectDto(testObjectSubObject); } target.IntValue = testObject.IntValue; target.StringValue = testObject.StringValue; @@ -199,4 +199,4 @@ private static string MapToString(global::Riok.Mapperly.IntegrationTests.Models. return target; } } -} \ No newline at end of file +} diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs index 3d77b56c3a2..e9ae203192c 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs @@ -56,38 +56,38 @@ public static partial int ParseableInt(string value) IntInitOnlyValue = DirectInt(src.IntInitOnlyValue), RequiredValue = DirectInt(src.RequiredValue), }; - if (src.NullableFlattening != null) + if (src.NullableFlattening is { } srcNullableFlattening) { - target.NullableFlatteningIdValue = CastIntNullable(src.NullableFlattening.IdValue); + target.NullableFlatteningIdValue = CastIntNullable(srcNullableFlattening.IdValue); } - if (src.NestedNullable != null) + if (src.NestedNullable is { } srcNestedNullable) { - target.NestedNullableIntValue = DirectInt(src.NestedNullable.IntValue); - target.NestedNullable = MapToTestObjectNestedDto(src.NestedNullable); + target.NestedNullableIntValue = DirectInt(srcNestedNullable.IntValue); + target.NestedNullable = MapToTestObjectNestedDto(srcNestedNullable); } - if (src.NestedNullableTargetNotNullable != null) + if (src.NestedNullableTargetNotNullable is { } srcNestedNullableTargetNotNullable) { - target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(src.NestedNullableTargetNotNullable); + target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(srcNestedNullableTargetNotNullable); } - if (src.StringNullableTargetNotNullable != null) + if (src.StringNullableTargetNotNullable is { } srcStringNullableTargetNotNullable) { - target.StringNullableTargetNotNullable = src.StringNullableTargetNotNullable; + target.StringNullableTargetNotNullable = srcStringNullableTargetNotNullable; } - if (src.TupleValue != null) + if (src.TupleValue is { } srcTupleValue) { - target.TupleValue = MapToValueTuple(src.TupleValue.Value); + target.TupleValue = MapToValueTuple(srcTupleValue); } - if (src.RecursiveObject != null) + if (src.RecursiveObject is { } srcRecursiveObject) { - target.RecursiveObject = MapToDtoExt(src.RecursiveObject); + target.RecursiveObject = MapToDtoExt(srcRecursiveObject); } - if (src.NullableReadOnlyObjectCollection != null) + if (src.NullableReadOnlyObjectCollection is { } srcNullableReadOnlyObjectCollection) { - target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(src.NullableReadOnlyObjectCollection); + target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(srcNullableReadOnlyObjectCollection); } - if (src.SubObject != null) + if (src.SubObject is { } srcSubObject) { - target.SubObject = MapToInheritanceSubObjectDto(src.SubObject); + target.SubObject = MapToInheritanceSubObjectDto(srcSubObject); } target.IntValue = DirectInt(src.IntValue); target.StringValue = src.StringValue; @@ -141,43 +141,43 @@ public static partial int ParseableInt(string value) IntInitOnlyValue = DirectInt(testObject.IntInitOnlyValue), RequiredValue = DirectInt(testObject.RequiredValue), }; - if (testObject.NullableFlattening != null) + if (testObject.NullableFlattening is { } testObjectNullableFlattening) { - target.NullableFlatteningIdValue = CastIntNullable(testObject.NullableFlattening.IdValue); + target.NullableFlatteningIdValue = CastIntNullable(testObjectNullableFlattening.IdValue); } - if (testObject.NullableUnflatteningIdValue != null) + if (testObject.NullableUnflatteningIdValue is { } testObjectNullableUnflatteningIdValue) { target.NullableUnflattening ??= new(); - target.NullableUnflattening.IdValue = DirectInt(testObject.NullableUnflatteningIdValue.Value); + target.NullableUnflattening.IdValue = DirectInt(testObjectNullableUnflatteningIdValue); } - if (testObject.NestedNullable != null) + if (testObject.NestedNullable is { } testObjectNestedNullable) { - target.NestedNullableIntValue = DirectInt(testObject.NestedNullable.IntValue); - target.NestedNullable = MapToTestObjectNestedDto(testObject.NestedNullable); + target.NestedNullableIntValue = DirectInt(testObjectNestedNullable.IntValue); + target.NestedNullable = MapToTestObjectNestedDto(testObjectNestedNullable); } - if (testObject.NestedNullableTargetNotNullable != null) + if (testObject.NestedNullableTargetNotNullable is { } testObjectNestedNullableTargetNotNullable) { - target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(testObject.NestedNullableTargetNotNullable); + target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(testObjectNestedNullableTargetNotNullable); } - if (testObject.StringNullableTargetNotNullable != null) + if (testObject.StringNullableTargetNotNullable is { } testObjectStringNullableTargetNotNullable) { - target.StringNullableTargetNotNullable = testObject.StringNullableTargetNotNullable; + target.StringNullableTargetNotNullable = testObjectStringNullableTargetNotNullable; } - if (testObject.TupleValue != null) + if (testObject.TupleValue is { } testObjectTupleValue) { - target.TupleValue = MapToValueTuple(testObject.TupleValue.Value); + target.TupleValue = MapToValueTuple(testObjectTupleValue); } - if (testObject.RecursiveObject != null) + if (testObject.RecursiveObject is { } testObjectRecursiveObject) { - target.RecursiveObject = MapToDtoExt(testObject.RecursiveObject); + target.RecursiveObject = MapToDtoExt(testObjectRecursiveObject); } - if (testObject.NullableReadOnlyObjectCollection != null) + if (testObject.NullableReadOnlyObjectCollection is { } testObjectNullableReadOnlyObjectCollection) { - target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(testObject.NullableReadOnlyObjectCollection); + target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(testObjectNullableReadOnlyObjectCollection); } - if (testObject.SubObject != null) + if (testObject.SubObject is { } testObjectSubObject) { - target.SubObject = MapToInheritanceSubObjectDto(testObject.SubObject); + target.SubObject = MapToInheritanceSubObjectDto(testObjectSubObject); } target.IntValue = DirectInt(testObject.IntValue); target.StringValue = testObject.StringValue; @@ -233,29 +233,29 @@ public static partial int ParseableInt(string value) IntInitOnlyValue = DirectInt(dto.IntInitOnlyValue), RequiredValue = DirectInt(dto.RequiredValue), }; - if (dto.NullableUnflattening != null) + if (dto.NullableUnflattening is { } dtoNullableUnflattening) { - target.NullableUnflatteningIdValue = CastIntNullable(dto.NullableUnflattening.IdValue); + target.NullableUnflatteningIdValue = CastIntNullable(dtoNullableUnflattening.IdValue); } - if (dto.NestedNullable != null) + if (dto.NestedNullable is { } dtoNestedNullable) { - target.NestedNullable = MapToTestObjectNested(dto.NestedNullable); + target.NestedNullable = MapToTestObjectNested(dtoNestedNullable); } - if (dto.TupleValue != null) + if (dto.TupleValue is { } dtoTupleValue) { - target.TupleValue = MapToValueTuple1(dto.TupleValue.Value); + target.TupleValue = MapToValueTuple1(dtoTupleValue); } - if (dto.RecursiveObject != null) + if (dto.RecursiveObject is { } dtoRecursiveObject) { - target.RecursiveObject = MapFromDto(dto.RecursiveObject); + target.RecursiveObject = MapFromDto(dtoRecursiveObject); } - if (dto.NullableReadOnlyObjectCollection != null) + if (dto.NullableReadOnlyObjectCollection is { } dtoNullableReadOnlyObjectCollection) { - target.NullableReadOnlyObjectCollection = MapToIReadOnlyCollection(dto.NullableReadOnlyObjectCollection); + target.NullableReadOnlyObjectCollection = MapToIReadOnlyCollection(dtoNullableReadOnlyObjectCollection); } - if (dto.SubObject != null) + if (dto.SubObject is { } dtoSubObject) { - target.SubObject = MapToInheritanceSubObject(dto.SubObject); + target.SubObject = MapToInheritanceSubObject(dtoSubObject); } target.IntValue = DirectInt(dto.IntValue); target.StringValue = dto.StringValue; @@ -307,38 +307,38 @@ public static partial int ParseableInt(string value) public static partial void UpdateDto(global::Riok.Mapperly.IntegrationTests.Models.TestObject source, global::Riok.Mapperly.IntegrationTests.Dto.TestObjectDto target) { - if (source.NullableFlattening != null) + if (source.NullableFlattening is { } sourceNullableFlattening) { - target.NullableFlatteningIdValue = CastIntNullable(source.NullableFlattening.IdValue); + target.NullableFlatteningIdValue = CastIntNullable(sourceNullableFlattening.IdValue); } - if (source.NestedNullable != null) + if (source.NestedNullable is { } sourceNestedNullable) { - target.NestedNullableIntValue = DirectInt(source.NestedNullable.IntValue); - target.NestedNullable = MapToTestObjectNestedDto(source.NestedNullable); + target.NestedNullableIntValue = DirectInt(sourceNestedNullable.IntValue); + target.NestedNullable = MapToTestObjectNestedDto(sourceNestedNullable); } - if (source.NestedNullableTargetNotNullable != null) + if (source.NestedNullableTargetNotNullable is { } sourceNestedNullableTargetNotNullable) { - target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(source.NestedNullableTargetNotNullable); + target.NestedNullableTargetNotNullable = MapToTestObjectNestedDto(sourceNestedNullableTargetNotNullable); } - if (source.StringNullableTargetNotNullable != null) + if (source.StringNullableTargetNotNullable is { } sourceStringNullableTargetNotNullable) { - target.StringNullableTargetNotNullable = source.StringNullableTargetNotNullable; + target.StringNullableTargetNotNullable = sourceStringNullableTargetNotNullable; } - if (source.TupleValue != null) + if (source.TupleValue is { } sourceTupleValue) { - target.TupleValue = MapToValueTuple(source.TupleValue.Value); + target.TupleValue = MapToValueTuple(sourceTupleValue); } - if (source.RecursiveObject != null) + if (source.RecursiveObject is { } sourceRecursiveObject) { - target.RecursiveObject = MapToDtoExt(source.RecursiveObject); + target.RecursiveObject = MapToDtoExt(sourceRecursiveObject); } - if (source.NullableReadOnlyObjectCollection != null) + if (source.NullableReadOnlyObjectCollection is { } sourceNullableReadOnlyObjectCollection) { - target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(source.NullableReadOnlyObjectCollection); + target.NullableReadOnlyObjectCollection = MapToTestObjectNestedDtoArray(sourceNullableReadOnlyObjectCollection); } - if (source.SubObject != null) + if (source.SubObject is { } sourceSubObject) { - target.SubObject = MapToInheritanceSubObjectDto(source.SubObject); + target.SubObject = MapToInheritanceSubObjectDto(sourceSubObject); } target.CtorValue = DirectInt(source.CtorValue); target.CtorValue2 = DirectInt(source.CtorValue2); @@ -681,4 +681,4 @@ private static string MapToString1(global::Riok.Mapperly.IntegrationTests.Dto.Te return target; } } -} \ No newline at end of file +}