简体   繁体   English

从HTML5 / JS中的UWP应用访问数据库

[英]Database access from UWP app in HTML5/JS

What is the best way to use a database (be it Redis, SQLite, WebSQL or just about anything actually) from a UWP app being developed in HTML5/Javascript ? HTML5 / Javascript开发的UWP应用程序使用数据库(Redis,SQLite,WebSQL或几乎所有其他工具)的最佳方法是什么? For a C# or VB.NET app I guess it would be quite easy, since you can just use stuff like this . 对于C#或VB.NET应用我想这将是很容易的,因为你可以使用的东西像这样 But how would I do that for a JS-based app? 但是对于基于JS的应用程序我该怎么做呢?

I guess one option would be to do a wrapper C# project and use that as a data layer (since I believe my JS/HTML project can invoke methods in my other projects in the solution). 我猜一个选择是做一个包装C#项目并将其用作数据层(因为我相信我的JS / HTML项目可以在解决方案的其他项目中调用方法)。 Is that the best/easiest way or are there any other really good options that I'm missing somehow? 这是最好/最简单的方法,还是我错过了其他任何真正好的选择? It feels a bit clumsy, since I would prefer a solution with 100% Javascript in this case. 感觉有点笨拙,因为在这种情况下,我更喜欢使用100%Javascript的解决方案。

You could use IndexedDB in UWP javascript apps. 您可以在UWP javascript应用程序中使用IndexedDB。

You can easily find samples online ( here for example) and relevant MSDN documentation is here . 您可以轻松地在线找到示例(例如此处 ),有关MSDN文档在此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM