I'm afraid it doesn't work the way you described it.
For one thing, the function isInitialized has to be implemented
manually. I've noticed you usually surround the invocations of this
function with a try-catch block, catching the ReferenceError in case
the function isn't implemented, but there is at least one place where
you don't do that, namely the function EntityManager.mergeEntity.
Maybe this is a bug and should be reported to JIRA?
Also, if I understand it correctly, the external dictionary of
entityManagers is only used if the Managed.entityManagerMode is set to
Managed.ENTITY_MANAGER_DICTIONARY. Otherwise, the function
Managed.getEntityManager invokes the meta::entityManager getter on an
entity. So, the field should definitely be there, unless one wants all
entities to be managed by external entity managers. Maybe the
functions Managed.getEntityManager and Managed.setEntityManager should
be changed to revert to the entityManager dictionary if the
entityManager field isn't in the entity?
Best regards,
Filip