We should probably start using the metadata factory for this kind of stuff, since it allows fetching repositories by entity alias, interface names (if you use weird listeners on the load metadata events) etc.