Added configuration option for RepositoryFactory

This will allow the use of a custom repository factory pulled from the SM (the option is available in ORM since 2.4).

If this is good for merge I'll pop the tests in.