Why aren't .NET “application settings” stored in the registry?

前端 未结 17 1732
醉话见心
醉话见心 2020-12-13 14:51

Some time back in the nineties, Microsoft introduced the Windows Registry. Applications could store settings in different hives. There were hives for application-wide and us

相关标签:
17条回答
  • 2020-12-13 15:04

    Another reason is that in order to edit the registry you would have to have higher amounts of permissions. If you are just editing an app config file you would only need to have rights to that file.

    0 讨论(0)
  • 2020-12-13 15:07

    I heard a fairly substantial rumor that the data storage format used by sharepoint and by team foundation server, backed by SQL, was originally intended to replace the windows file system in windows 7. If this was the plan, then windows would have gained / (will someday?) gain a transactional data store for storing lists of data. This data storage method would probably be superior in every way to the registry.

    Given that, it's hardly suprising to see Microsoft minimize the use of the registry as they move forward with the .net framework.

    0 讨论(0)
  • Application portability can be one reason. Application folders can be copied from one computer to other and settings will go with the application. Useful when running applications from usb flash drives on multiple computers.

    0 讨论(0)
  • 2020-12-13 15:11

    instead of simply using the registry

    The registry is NOT simple. On my PC, it's a 40MB binary mess, and I hope the bits inside it don't change their mind.

    Isn't this exactly what the registry was intended for?

    Yes. But then again, DLLs were intended to provide shared functionality to different applications.

    0 讨论(0)
  • 2020-12-13 15:13

    It seems to me that the registry is one of those things that "seemed like a good idea at the time" - for all the many reasons already listed by others. There is nothing wrong with realizing that something was not such a great idea after all, and instead using an alternative that is simpler and more convenient, even if it may seem like a step backwards in certain ways.

    0 讨论(0)
  • 2020-12-13 15:13

    I think the new way of .config file helps by:

    • Give the applications the flexibility to provide their own configurations as an override to the default configurations provided - consider the case of web.config overriding the machine.config
    • Sometimes, it might not be possible to change the registry settings since you might not have the rights needed. So, a config file allows you to make changes applicable for your own application without needing the additional rights
    • With a registry entry, multiple application could potentially be using the same configuration. But if you change it for your application, you might cause un-intended behaviour on the other applications & you might not have complete information about this

    Just some thoughts that come to mind...

    HTH.

    0 讨论(0)
提交回复
热议问题