static void DoTransfer <TDestination, TSource>(ref TDestination destination, ref TSource source, ref ChangeTracker changeTracker)
 {
     if (RuntimeTypeInfoCache <TSource> .IsAbstractOrInterface() || typeof(TSource) != source.GetType())
     {
         var propertyBag = PropertyBagResolver.Resolve(source.GetType());
         var action      = new TransferAbstractType <TDestination>
         {
             Destination     = destination,
             SourceContainer = source
         };
         propertyBag.Cast(ref action);
         destination = action.Destination;
     }
     else
     {
         Visit(ref destination, new TransferVisitor <TSource>(source), ref changeTracker);
     }
 }
Example #2
0
 static void Transfer <TDstContainer, TSrcContainer>(
     ref TDstContainer dstContainer,
     ref TSrcContainer srcContainer,
     VisitResult result)
 {
     if (RuntimeTypeInfoCache <TDstContainer> .IsAbstractOrInterface() || typeof(TDstContainer) != dstContainer.GetType())
     {
         var propertyBag = PropertyBagResolver.Resolve(dstContainer.GetType());
         var action      = new TransferAbstractType <TSrcContainer>
         {
             Result            = result,
             SrcContainer      = srcContainer,
             DstContainerBoxed = dstContainer
         };
         propertyBag.Cast(ref action);
         dstContainer = (TDstContainer)action.DstContainerBoxed;
     }
     else
     {
         var visitor = new TransferVisitor <TDstContainer>(dstContainer, result);
         Visit(ref srcContainer, ref visitor);
         dstContainer = visitor.Target;
     }
 }