Preserve nids script add in migrate d2d
Unfortunately, sometimes answers on stackexchange are misleading.  It doesn't look like ANY classes within migrate_d2d extend MigrateDestinationEntity, that invokes a "prepare" hook.  So I think the question itself is misguided.

Looking in the migrate code, it looks like any class that extends abstract class MigrateDestinationEntity can call this process function see
/migrate/plugins/destinations/entity.inc,

on line 140:

// Then call any entity-specific handlers
migrate_handler_invoke_all($this-&gt;entityType, 'prepare', $entity, $source_row);


Rather than trying to find a place to call this from DrupalNodeMigration, which will never call this function, what you need to do is add a mapping for nid, and a mapping for "is_new".

In your class that extends the DrupalNodeMigration class, in the __contruct() function, just make sure to add a mapping for nid and is_new.

$this-&gt;addFieldMapping('nid', 'nid');
$this-&gt;addFieldMapping('is_new')-&gt;defaultValue(TRUE);


Otherwise, nid will be automatically assigned.