SetMediaStorage approach causes unexpected behavior. #73
Description
Update:
After taking a deep dive into AzureBlob
, I've realized that there's a much worse issue at play here. SetMediaStorage is called by AzureBlob to set itself as the media storage for CosmosDb:
The caveat is the if
instruction. This means that if the Repository is still null, for some reason, then AzureBlob isn't set as the media storage. However, if later on the repository is set, it will not detect that a MediaStorage was set and will use it's default behavior.
This means that the order of initialization may affect this code - calling Workbench.Use... for MediaStorage before calling it for Repository will lead to this unexpected behavior.
This has to be escalated to a bug, since this may bite our users in the a**.
Old issue:
For good or evil, Liquid is based on a service locator pattern (see #39). There's, however, a method on a base class, ILightRepository
, that sets a dependant service to the repository implementation:
My guess is that this is a mistake. Repositories should be using WorkBench
to obtain a copy of the ILightMediaStorage
to use.