Stop depending on global state for toString.

__toString should be implemented in a way that doesn't rely on
global state or resources. This is now fixed for EntityId.

Change-Id: I319b5fb7952335864f4a29bb6170fd73b20dea52