如何决定存储每个用户的状态呢?注册?应用程序数据?独立存储? [英] How to decide where to store per-user state? Registry? AppData? Isolated Storage?

查看:97
本文介绍了如何决定存储每个用户的状态呢?注册?应用程序数据?独立存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应Windows注册表用于每个用户的状态,我们什么时候应该使用的文件系统,特别是用户的AppData文件夹? (如C:\\ Users \\用户名\\ AppData)。哪里独立存储进来吗?

When should the Windows Registry be used for per-user state, and when should we use the filesystem, particularly the user's AppData folder? (eg, C:\Users\USERNAME\AppData). Where does Isolated Storage come in?

有没有pretty坚定的规则,或者是它只是一个模糊的东西,像使用注册表,直到它变得太数据在注册表中存储。或者使用任何你觉得像使用。

Is there a pretty firm rule, or is it just a fuzzy thing, like "use the registry until it becomes too much data to store in the registry". or "use whatever you feel like using."

有没有影响判决的Windows徽标要求?

Are there Windows logo requirements that affect the decision?

如果我使用AppData目录,我怎么市话,漫游和LocalLow之间进行选择?

If I use the AppData directory, how do I choose between Local, Roaming and LocalLow ?

编辑:我只注意到这些类似的问题:

edit: I just noticed these similar questions:

  • When and why should you store data in the Registry?
  • Registry vs Ini file for storing user-configurable app settings.

我就总结的答复。

推荐答案

如果您有少量的键/值对和值没有大的注册表是伟大的 - 你不关心Xcopy部署 - 然后使用注册表(我知道这是不准确的,但工作时的注册表变得痛苦它通常是显而易见的)。

If you have a small number of key/value pairs and the values aren't big the registry is great - and you don't care about xcopy deployment - then use the registry (I know this isn't exact, but it's usually obvious when working with the registry becomes a pain).

如果你想Xcopy部署中的数据必须在同一文件夹中的程序明显 - 但是程序可以AppData文件夹下的某个地方,它并不一定要在程序文件

If you want xcopy deployment the data must be in the same folder as the program obviously - but the program can be somewhere under the AppData folder, it doesn't have to be under "program files".

使用独立存储,只有当你需要它,或者不得不使用它 - 例如ClickOnce的

Use isolated storage only when you need it or have to use it - for example ClickOnce.

否则,使用应用程序数据\\漫游,使用Local或LocalLow只有当你有一个很好的理由。

Otherwise use AppData\Roaming, use Local or LocalLow only if you have a good reason.

编辑:这里是漫游,本地和LocalLow的区别是:

Here is the difference between Roaming, Local and LocalLow:

Windows有所谓的漫游配置文件一个鲜为人知的功能,一般的想法是,在企业环境中启用此功能的任何用户可以使用任何一台计算机。

Windows has a little known feature called "roaming profiles", the general idea is that in a corporate environment with this feature enabled any user can use any computer.

当在他的私人设置的用户日志从服务器下载,当他注销了他的设置上载回服务器(实际的过程比较复杂,很明显)。

When a user logs in his private settings are downloaded from the server and when he logs out his settings are uploaded back to the server (the actual process is more complicated, obviously).

文件在用户的漫游,在XP中Vista或应用程序数据文件夹走动与用户 - 因此,任何设置和数据应该存储在那里。

Files in the User's "Roaming" folder in Vista or "Application Data" in XP move around with the user - so any settings and data should be stored there.

在本地和LocalLow,在Vista和XP中的本地设置文件没有,所以它是临时文件,东西都是绑定到特定的计算机或数据可以被重新计算的好地方。

Files under "Local" and "LocalLow" in vista and "Local Settings" in XP do not, so it's a good place for temp files, things that are tied to the specific computer or data that can be recalculated.

在Vista中,随着新的安全功能,我们都知道,爱的一部分,你可以在低完整性模式正在运行的程序(比如IE浏览器在保护模式下),这些程序都与减少权限运行,并且不能在用户的配置文件的访问 - 除了LocalLow文件夹下的文件

In Vista, as part of the new security features we all know and love, you can have programs running in "low integrity mode" (for example IE in protected mode), those programs are running with reduced privileges and can't access files in the user's profile - except for files under the "LocalLow" folder.

所以,最后,保存在LocalLow文件本身是不安全的,在本地/本地设置文件可能是在一些大公司不可用 - 所以,除非你有很好的理由,知道你是什么做去与漫游/应用程序数据。

So, in conclusion, files stored in "LocalLow" are inherently insecure and files in "Local"/"Local Settings" are likely to be unavailable in some large companies - so unless you have good reason and know exactly what you are doing go with "Roaming"/"Application Data".

这篇关于如何决定存储每个用户的状态呢?注册?应用程序数据?独立存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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