Windows 注册表最佳实践 [英] Windows Registry best practices

查看:43
本文介绍了Windows 注册表最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 注册表的用途是什么?我知道存储少量用户首选项没问题,但是将所有用户数据存储在那里是否被认为是不好的做法?我认为这将取决于数据集,那么对于少量数据,比如小于 2KB,在 100 个左右不同的键/值对中如何.这是不好的做法吗?平面文件或 SQLite 数据库是更好的做法吗?

In what way is the Windows registry meant to be used? I know it's alright to store a small amount of user preferences, but is it considered bad practice to store all your users data there? I would think it would depend on the data set, so how about for small amounts of data, say, less than 2KB, in 100 or so different key/value pairs. Is this bad practice? Would a flat file or SQLite db be a better practice?

推荐答案

对我来说,简单的用户配置项和用户数据最好存储在简单的 XML 配置文件、SQLLite 数据库或 MS SQL Server Compact 中D b.确切的存储介质取决于实现的细节.

For me, simple user configuration items and user data is better to be stored in either a simple XML configuration file, a SQLLite db, or a MS SQL Server Compact db. The exact storage medium depends on the specifics of the implementation.

我只将注册表用于我需要不经常设置且用户不需要能够更改/查看的内容.例如,我之前在注册表中存储了加密的许可信息,以避免用户意外删除数据.

I only use the registry for things that I need to set infrequently and that users don't need to be able to change/see. For example, I have stored encrypted license information in the registry before to avoid accidental user removal of the data.

这篇关于Windows 注册表最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆