'C# EF core enable or disable database write based on availability of connection string

I need to enable or disable the database CRUD operations based on the availability of the connection string.

The app is already developed application and having database CRUD operations scattered around the application.

Now there are some customers want to run the application without the CRUD operations and they do not want to invest on database server. Since the CRUD operations are scattered around the application and no repository pattern or unit of work pattern is implemented, is there a way to stop the CRUD operations at the DB context level rather than going through each CRUD operations and changing.

If I can enable or disable the CRUD operations based on the availability of the connection string, that would be grate.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source