@@ -169,7 +169,7 @@ protected Expression CreateBlockExpressionBody(Expression source, Expression? de
169169 var blocks = new List < Expression > ( ) ;
170170 var label = Expression . Label ( arg . DestinationType ) ;
171171
172- //var drvdSource = source as TDerivedSource
172+ //var drvdSource = _source as TDerivedSource
173173 //if (drvdSource != null)
174174 // return adapt<TSource, TDest>(drvdSource);
175175 foreach ( var tuple in arg . Settings . Includes )
@@ -244,7 +244,7 @@ protected Expression CreateBlockExpressionBody(Expression source, Expression? de
244244 else
245245 {
246246 //TDestination result;
247- //if (source == null)
247+ //if (_source == null)
248248 // return default(TDestination);
249249 if ( source . CanBeNull ( ) )
250250 {
@@ -263,15 +263,15 @@ protected Expression CreateBlockExpressionBody(Expression source, Expression? de
263263 assignActions . Add ( Expression . Assign ( transformedSource , transform ) ) ;
264264 assignActions . Add ( assign ) ;
265265
266- //before(source , result, destination);
266+ //before(_source , result, destination);
267267 var beforeMappings = arg . Settings . BeforeMappingFactories . Select ( it => InvokeMapping ( it , source , result , destination , arg , true ) ) . Reverse ( ) ;
268268 assignActions . AddRange ( beforeMappings ) ;
269269
270- //result.prop = adapt(source .prop);
270+ //result.prop = adapt(_source .prop);
271271 var mapping = CreateBlockExpression ( transformedSource , result , arg ) ;
272272 var settingActions = new List < Expression > { mapping } ;
273273
274- //after(source , result, destination);
274+ //after(_source , result, destination);
275275 var afterMappings = arg . Settings . AfterMappingFactories . Select ( it => InvokeMapping ( it , source , result , destination , arg , false ) ) . Reverse ( ) ;
276276 settingActions . AddRange ( afterMappings ) ;
277277
@@ -280,13 +280,13 @@ protected Expression CreateBlockExpressionBody(Expression source, Expression? de
280280
281281 //using (var scope = new MapContextScope()) {
282282 // var references = scope.Context.Reference;
283- // var key = new ReferenceTuple(source , typeof(TDestination));
283+ // var key = new ReferenceTuple(_source , typeof(TDestination));
284284 // if (references.TryGetValue(key, out var cache))
285285 // return (TDestination)cache;
286286 //
287287 // var result = new TDestination();
288- // references[source ] = (object)result;
289- // result.prop = adapt(source .prop);
288+ // references[_source ] = (object)result;
289+ // result.prop = adapt(_source .prop);
290290 // return result;
291291 //}
292292
@@ -374,7 +374,7 @@ private static Expression InvokeMapping(
374374
375375 protected Expression ? CreateInlineExpressionBody ( Expression source , CompileArgument arg )
376376 {
377- //source == null ? default(TDestination) : adapt(source )
377+ //_source == null ? default(TDestination) : adapt(_source )
378378
379379 var exp = CreateInlineExpression ( source , arg ) ;
380380 if ( exp == null )
@@ -476,17 +476,19 @@ protected Expression CreateAdaptExpression(Expression source, Type destinationTy
476476 }
477477 internal Expression CreateAdaptExpression ( Expression source , Type destinationType , CompileArgument arg , MemberMapping ? mapping , Expression ? destination = null )
478478 {
479- if ( source . Type == destinationType && arg . MapType == MapType . Projection )
480- return source ;
479+ var _source = source . NullableEnumExtractor ( ) ; // Extraction Nullable Enum
481480
482- //adapt(source);
481+ if ( _source . Type == destinationType && arg . MapType == MapType . Projection )
482+ return _source ;
483+
484+ //adapt(_source);
483485 var notUsingDestinationValue = mapping is not { UseDestinationValue : true } ;
484- var exp = source . Type == destinationType && arg . Settings . ShallowCopyForSameType == true && notUsingDestinationValue &&
485- ! arg . Context . Config . HasRuleFor ( source . Type , destinationType )
486- ? source
487- : CreateAdaptExpressionCore ( source , destinationType , arg , mapping , destination ) ;
486+ var exp = _source . Type == destinationType && arg . Settings . ShallowCopyForSameType == true && notUsingDestinationValue &&
487+ ! arg . Context . Config . HasRuleFor ( _source . Type , destinationType )
488+ ? _source
489+ : CreateAdaptExpressionCore ( _source , destinationType , arg , mapping , destination ) ;
488490
489- //transform(adapt(source ));
491+ //transform(adapt(_source ));
490492 if ( notUsingDestinationValue )
491493 {
492494 var transform = arg . Settings . DestinationTransforms . Find ( it => it . Condition ( exp . Type ) ) ;
0 commit comments