as_entity_trait in Entity now uses lifetime instead of lambda.