.NET 应用程序中应用程序数据的保存位置
我的应用程序类似于联系人管理器。假设用户可以输入联系人及其地址。我有代码和技术可以将我的联系人保存到文件中。但我该在哪里保存该文件呢?
考虑到这是一个在 Windows 上运行的 .NET 应用程序。我的文件应该存放在用户文件夹的 AppData 中吗?我应该使用独立存储(如此处所述)吗?还有别的事吗?推荐的做法是什么?
My application is something similar to a Contact Manager. Let's say a user can enter contacts with their addresses. I have the code and technology to save my contacts to a file. But where do I save that file?
Considering this is a .NET application running on Windows. Should my file end up in the AppData of the users folder? Should I use the Isolated Storage (as mentioned here)? Something else? What's the recommended practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终使用了帕特里克建议的解决方案:
I ended up using the solution Patrick suggested:
您有多种选择;正如你所说,独立存储就是其中之一。您还可以使用用户设置框架功能并将数据保存为数据 blob 或 XML。
您还可以查看 SqlCompact,它是一个非常轻量级的进程内数据库。然后,您可以将所有用户联系人保存在单个数据库中,该数据库可以与应用程序位于同一目录中;您可以轻松地将 EF4 之类的东西用于您的 DAL。
不过,这可能需要付出更多的努力,因为听起来您当前的架构已经完成了 99%。
You have a number of options; as you say, Isolated Storage is one of them. You could also use the User Settings framework feature and save the data as a blob of data, or as XML.
You could also take a look at SqlCompact for a very lightweight in-process database. You can then save all user contacts in a single database which could live e.g. in the same directory as the application; you could easily use something like EF4 for your DAL.
That might be a bit more effort though, as it sounds like you are 99% of the way there with your current architecture.