An interesting question at an interview.
Some interesting answers here
The big difference between a singleton and a bunch of static methods is that singletons can implement interfaces (or derive from useful base classes, although that’s less common, in my experience), so you can pass around the singleton as if it were “just another” implementation.
A static class allows only static methods.
A singleton can be initialized lazily or asynchronously while a static class is generally initialized when it is first loaded, leading to potential class loader issues. However the most important advantage, though, is that singletons can be handled polymorphically without forcing their users to assume that there is only one instance.
Investigation still ongoing. 🙂
An answer I received today is that Singleton is thread safe(or can be made), whyle static is not.
Static is created once at the start of the application.
Another is that you can inherit, transform Sigleton class.
Still looking for more answers.
If you want to create a vertical menu that scrolls through the items as you scrolls through the page
Let us say we have 2 tables that are in a parent-child relation.
We want to make a copy of the FormSectionInstance rows, but also copy and correlate the FormDetails rows.
This means copy rows from 2 tables and then set them up with the correct NEW corresponding IDs.
We could use a cursor, but a better alternative is the the MERGE INTO function.
We also create a TEMP transition table to hold the new VS old values. We use these values when we insert the CHILD values.
This way we can make the INSERT faster.
This solution is usefull when you want to debug on multiple environments.
Just add ad template file, some transformation config files and then select your desired Solution configuration.
Web config will be changed on the spot.
Also usefull when you want to publish on different environments.
You can setup different web.cofig configurations.