These are chat archives for ExtCore/ExtCore

Feb 2018
Ryan Salt
Feb 13 2018 20:14

@DmitrySikorsky Hi Dmitry - I think i've solved my multiple databases issue using generics - I've created generic versions of Storage, StorageContext, StorageContextOptions, and various other classes within ExtCore.

I can now have a controller with private IStorage<FirstStorageContext> storage; and a constructor of public ExtensionAController(IStorage<FirstStorageContext> storage) and it does connect to the correct database depending on the context i've specified. The generic type in IStorage<T> is constrained to an empty class at the moment, but could be anything. This type is then carried down the chain to the other classes so that the correct options, storagecontext and storage can be resolved.

The only issues i've come across in limited testing is applying Migrations where I can't output StorageContextBase<T> from DesignTimeStorageContextFactoryBase() and how to specify the AddStorageAction correctly.