Win8 metrostyle应用程序中结构化数据的本地存储

时间:2021-09-05 16:29:57

In a desktop .NET application, the standard option for implementing a local relational database is to use SQL Server Compact Edition, and then of course there is the possibility to use SQLite and other third-party engines.

在桌面. net应用程序中,实现本地关系数据库的标准选项是使用SQL Server Compact Edition,然后当然有可能使用SQLite和其他第三方引擎。

What are the options available to a .NET Metro-style application? SQL CE seems to be unavailable - any replacement? In fact, the entire System.Data namespace seems to be gone - so no LINQ to SQL or Entity Framework, either?

net metro样式的应用程序有哪些选项?SQL CE似乎不可用——有替换吗?事实上,整个系统。数据名称空间似乎消失了——因此也没有SQL的LINQ或实体框架?

What about HTML5 IndexedDB that seems to be available to Metro HTML/JS apps - can that be used from .NET somehow?

HTML5 IndexedDB如何?它似乎可以被Metro HTML/JS应用程序使用——它是否可以从。net中使用?

2 个解决方案

#1


2  

Apparently, the Extensible Storage Engine Win32 API (aka "JET Blue") is still available in Metro apps. C++ ones can use it directly via #include <esent.h>. .NET apps would have to use P/Invoke. This does not give SQL or any other sort of high-level relational querying constructs, but it does provide for key lookup, transactions, multiple indices per table, and multi-field indices.

显然,可扩展存储引擎Win32 API(又名“JET Blue”)在Metro应用程序中仍然可用。c++可以直接使用它,包括 . . net应用程序必须使用P/Invoke。这并不提供SQL或任何其他类型的高级关系查询结构,但是它提供了键查找、事务、每个表的多个索引和多字段索引。

#2


0  

Let's be clear: SQL CE exists in Windows 8. It exists not only in Program Files but in Windows\System32 to seem even more embedded than before. Windows7 doesn't have sqlcecompact40.dll in system32 so this is definitely new. System.Data and System.Data.Linq both live in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.

让我们明确一点:SQL CE存在于Windows 8中。它不仅存在于程序文件中,还存在于Windows\System32中,看起来比以前更加嵌入式。Windows7多没有sqlcecompact40。这绝对是新的。系统。数据和System.Data。Linq都生活在微软C:\Program Files (x86)\Reference组件\ \ Framework.NETFramework \ v4.5开发。

You can add references to those dlls manually but getting the app to compile is hit or miss. It seems that if you first open your project and do nothing, you can add a reference to those dlls anywhere and compile the app. If you remove the dlls and try to add them back you're hit with a "A reference to '<4.5 framework directory>' could not be added. If by some chance you can't add them via Visual Studio you can easily just add the HintPath manually.

你可以手动添加引用dll但是编译的应用程序是打击或小姐,看来,如果你第一次打开您的项目,什么也不做,你可以在任何地方添加一个引用这些dll和编译应用程序。如果你把dll并尝试添加回你了”目录> < 4.5框架的引用不能被添加。如果由于某种原因您不能通过Visual Studio添加它们,您可以轻松地手动添加HintPath。

My app now compiles but I also ran into an issue where linking the AppX wasn't working correctly and it gave a cryptic "Payload cannot contain 2 of the same dll" type messages. Like it was trying to include both 32 bit (the one I linked) and 64bit at the last minute. It included DLLs I wasn't touching manually like System.Data.OracleClient or System.Transactions so it was definitely some artifact from the build process I've yet to see again.

我的应用程序现在正在编译,但我也遇到了一个问题:连接AppX的方法不正确,它给出了一个神秘的“有效负载不能包含两个相同的dll”类型消息。就像它试图在最后一分钟同时包含32位(我链接的那个)和64位。它包括我没有像System.Data那样手动触摸的dll。OracleClient或系统。事务,所以它肯定是来自构建过程的某个工件,我还没有再次看到。

The main issue I'm dealing with right now is how to generate a proper connection string since it won't initialize properly without one. SQL CE is likely still looking for hardcoded C:\ references so the ApplicationData samples may not work as desired. I may try to make SQL CE 4 databases in Win7, transfer to Win8 and simply reference them locally but I'm kind of in the same boat there too. This | | close!

我现在要处理的主要问题是如何生成一个合适的连接字符串,因为没有它就不能正确初始化。SQL CE可能仍然在寻找硬编码的C:\引用,因此应用程序数据样本可能无法正常工作。我可能会尝试在Win7中创建SQL CE 4数据库,转到Win8,并简单地在本地引用它们,但是我在那里也有同样的情况。这| |关闭!

Please feel free to comment regarding any issues you run into and I'm definitely down for some offline collaboration if anyone would like to pool resources. This is definitely a thick forest of beasts and going it alone is proving a lot more challenging.

如果您遇到任何问题,请随时发表意见,如果有人愿意共享资源,我肯定会支持一些离线协作。这绝对是一片茂密的野兽森林,单靠自己的力量是很有挑战性的。

#1


2  

Apparently, the Extensible Storage Engine Win32 API (aka "JET Blue") is still available in Metro apps. C++ ones can use it directly via #include <esent.h>. .NET apps would have to use P/Invoke. This does not give SQL or any other sort of high-level relational querying constructs, but it does provide for key lookup, transactions, multiple indices per table, and multi-field indices.

显然,可扩展存储引擎Win32 API(又名“JET Blue”)在Metro应用程序中仍然可用。c++可以直接使用它,包括 . . net应用程序必须使用P/Invoke。这并不提供SQL或任何其他类型的高级关系查询结构,但是它提供了键查找、事务、每个表的多个索引和多字段索引。

#2


0  

Let's be clear: SQL CE exists in Windows 8. It exists not only in Program Files but in Windows\System32 to seem even more embedded than before. Windows7 doesn't have sqlcecompact40.dll in system32 so this is definitely new. System.Data and System.Data.Linq both live in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.

让我们明确一点:SQL CE存在于Windows 8中。它不仅存在于程序文件中,还存在于Windows\System32中,看起来比以前更加嵌入式。Windows7多没有sqlcecompact40。这绝对是新的。系统。数据和System.Data。Linq都生活在微软C:\Program Files (x86)\Reference组件\ \ Framework.NETFramework \ v4.5开发。

You can add references to those dlls manually but getting the app to compile is hit or miss. It seems that if you first open your project and do nothing, you can add a reference to those dlls anywhere and compile the app. If you remove the dlls and try to add them back you're hit with a "A reference to '<4.5 framework directory>' could not be added. If by some chance you can't add them via Visual Studio you can easily just add the HintPath manually.

你可以手动添加引用dll但是编译的应用程序是打击或小姐,看来,如果你第一次打开您的项目,什么也不做,你可以在任何地方添加一个引用这些dll和编译应用程序。如果你把dll并尝试添加回你了”目录> < 4.5框架的引用不能被添加。如果由于某种原因您不能通过Visual Studio添加它们,您可以轻松地手动添加HintPath。

My app now compiles but I also ran into an issue where linking the AppX wasn't working correctly and it gave a cryptic "Payload cannot contain 2 of the same dll" type messages. Like it was trying to include both 32 bit (the one I linked) and 64bit at the last minute. It included DLLs I wasn't touching manually like System.Data.OracleClient or System.Transactions so it was definitely some artifact from the build process I've yet to see again.

我的应用程序现在正在编译,但我也遇到了一个问题:连接AppX的方法不正确,它给出了一个神秘的“有效负载不能包含两个相同的dll”类型消息。就像它试图在最后一分钟同时包含32位(我链接的那个)和64位。它包括我没有像System.Data那样手动触摸的dll。OracleClient或系统。事务,所以它肯定是来自构建过程的某个工件,我还没有再次看到。

The main issue I'm dealing with right now is how to generate a proper connection string since it won't initialize properly without one. SQL CE is likely still looking for hardcoded C:\ references so the ApplicationData samples may not work as desired. I may try to make SQL CE 4 databases in Win7, transfer to Win8 and simply reference them locally but I'm kind of in the same boat there too. This | | close!

我现在要处理的主要问题是如何生成一个合适的连接字符串,因为没有它就不能正确初始化。SQL CE可能仍然在寻找硬编码的C:\引用,因此应用程序数据样本可能无法正常工作。我可能会尝试在Win7中创建SQL CE 4数据库,转到Win8,并简单地在本地引用它们,但是我在那里也有同样的情况。这| |关闭!

Please feel free to comment regarding any issues you run into and I'm definitely down for some offline collaboration if anyone would like to pool resources. This is definitely a thick forest of beasts and going it alone is proving a lot more challenging.

如果您遇到任何问题,请随时发表意见,如果有人愿意共享资源,我肯定会支持一些离线协作。这绝对是一片茂密的野兽森林,单靠自己的力量是很有挑战性的。