Implement dynamic entity registration as per 3.x branch: 2978ab1