Local database storage for WinRT/Metro application

2019-02-16 06:09发布

I am trying to find an API within WinRT that will allow me to create a local database that can be used to store data for an occasionally connected application. I am looking for something like SQL Compact Edition.

I have seen various messages on various boards indicating that there either

  • (a) will be no local databases whatsoever
  • (b) no local "server" databases (i.e. SQL Express type instances)
  • (c) A local database code named "Jet Blue".

Does anybody have a definitive answer to this? I do not want to start down this road if it is blocked.

6条回答
Summer. ? 凉城
2楼-- · 2019-02-16 06:24

There are 3rd party solutions coming out or are already out. CodePlex has one -- http://sqlwinrt.codeplex.com/

The other option, which requires some work on your part, is to proxy your database access through a web service.

查看更多
可以哭但决不认输i
3楼-- · 2019-02-16 06:30

There is no SQL CE available for Metro.

a) will be no local databases whatsoever

This is not true. SQLite should be able to run on WinRT. You can download the code here and include the two main files into your WinRT project. To compile and pass certification you will need to make sure you are using the correct WinRT replacement calls for the Win32 calls that are not supported. The 3rd party solution Bob mentioned is a WinRT wrapper it doesn't include changes to SQLite to pass certification.

(b) no local "server" databases (i.e. SQL Express type instances)

It seems unlikely there will be SQL Express for metro.

(c) A local database code named "Jet Blue".

If you mean Microsoft Jet Database engine, yes that seems to be supported but I would rather use SQLite.

Also remember if you are using HTML/JS you have the option of using IndexedDB

查看更多
Luminary・发光体
4楼-- · 2019-02-16 06:31

There is no (built in) database according to this
http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-930C

查看更多
看我几分像从前
5楼-- · 2019-02-16 06:32

Do you really need a "store data for an occasionally connected application"? This sounds a little overkill to me. Why not serialize the data (various options) to storage yourself?

查看更多
够拽才男人
6楼-- · 2019-02-16 06:42

SQLite is now officially supported. See Tim Heuer's blog for details. For simpler solution with less data you can use http://winrtdatabase.codeplex.com/

查看更多
萌系小妹纸
7楼-- · 2019-02-16 06:51

You might want to have a look at SQLite3-WinRT, a wrapper for SQLite that we wrote to use it in a Metro-style application. It contains a version of SQLite that uses only WinRT-compatible API, and a WinRT component to use it in C# and JavaScript apps.

查看更多
登录 后发表回答