在 Windows 8 Metro 应用中存储用户数据
我正在学习如何开发 Windows 8 Metro 风格应用程序,但我找不到在 SQL Server 中存储用户数据的方法。
我可以使用什么或如何存储用户数据。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我正在学习如何开发 Windows 8 Metro 风格应用程序,但我找不到在 SQL Server 中存储用户数据的方法。
我可以使用什么或如何存储用户数据。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
您无法从 Metro 应用程序访问本地“桌面服务”。因此您将无法与本地 SQL Server 通信。
您可以使用存储您的信息的在线服务,也可以使用本地存储。
请查看:
这个问题也有争议 此处 和 此处
You cannot access local "desktop services" from the Metro app. So you will not be able to communicate with a local SQL Server.
You can use online services that store your information or you can use local storage.
Take a look at:
That question is also debated here and here
您可以将 SQLite 用于 Windows 运行时
这是一篇解释如何使用它的博客文章:
http://timheuer.com/blog/archive/2012/08/07/updated-how-to-using-sqlite-from-windows-store-apps.aspx
You can use SQLite for Windows Runtime
Here is a blog post explaining how to use it:
http://timheuer.com/blog/archive/2012/08/07/updated-how-to-using-sqlite-from-windows-store-apps.aspx
有几种存储数据的方法 - 漫游设置(如果您希望在安装了您的应用程序的所有 win8 设备上都可以使用相同的数据)、独立存储中的应用程序设置。关于在 SQL Server 中存储数据,由于您无法使用 Metro 应用程序部署 SQL 数据库,因此您需要有一个客户端-服务器架构来在 SQL Server 数据库前面托管您的服务。
There are couple of ways of storing data - Roaming Settings (if you want the same data to be available across all the win8 devices he has installed your application), Application Settings in Isolated Storage. About storing data in SQL server, as you cannot deploy sql database with Metro app, you need to have a client-server arch to host your service in front of a sql server db.
除了您已经得到的答案之外,不要忘记标准的 HTML5 localStorage,它应该跨平台工作,因此有助于代码的可重用性。允许多少空间并不是标准,但所有平台上事实上的标准量约为 5MB。 Windows 8 上的 Metro 风格应用程序可能更多,但这只是猜测。
In addition to the answers you've already gotten, don't forget standard HTML5 localStorage, which should work across platforms and therefore help code reusability. What's not a standard is how much space you're allowed, but the de facto standard amount is about 5MB in all platforms. It might be more on Windows 8 for Metro style apps, but that's just a guess.