Is it possible to pass dynamic values to registryType?

I have a registryType function that creates a mongodb connection but I want the values it is using to register with to be dynamic. Is there a good way to do this?