Can we set database mode read-only programmatically without application recycling? I don't want to use appsettings.
Hi, have you checked could you implement your own IDatabaseMode (as the interface defines the DatabaseMode property as only get) and inheriting the default implementation and adding on top of that your own custom logic?
The question is a bit ambiguous. Technically, it is possible. It's just a value reading from appsettings. The internal DatabaseModeService class registered as singleton service does the actual job. In the real scenario, how would you prevent the current running application being interrupted or impacted while changing the value programmatically during the runtime?
Thanks, both for your responses.
Of course, I don't want to change app settings at runtime, as that means an application recycles but I want to achieve all the below functionalities. DatabaseModeService returns the status back but doesn't do the actual functionality.
In the ReadOnly mode, the application can only load data from the database. The following modules and functions are affected in the ReadOnly mode:
If I don't misunderstand your question, unfortunately, the IDatabaseMode is only used to fetch the static value from what I can see through ILSpy. Each functional areas you mentioned above has injected IDatabaseMode interface and program against the static value. E.g. the screenshot below is the Scheuler service-disabled function.
:) my question is can we move/set EPi to read-only mode while the site is up & running without any disruption or recycling.