I've now implemented a separate project with a module and configured the db context in the PreInitialize() method. This is now working, so non issue :)