Xamarin SQLite“这是‘诱饵’"

Xamarin SQLite quot;This is the #39;bait#39;quot;(Xamarin SQLite“这是‘诱饵’)
本文介绍了Xamarin SQLite“这是‘诱饵’"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我按照 this 指南尝试创建 SQLite 数据库以我的项目.但是总是出现同样的错误,完全按照文章的步骤操作.

I follow this guide trying to create a SQLite database to my proyect. But always got same error, doing the exactly steps of the article.

    System.Exception: This is the 'bait'.  You probably need to add one of the SQLitePCLRaw.bundle_* nuget packages to your platform project.

推荐答案

您是否已将 SQLite 包添加到您的所有项目中?您需要将其添加到应用项目以及 PCL 中.

Have you added the SQLite package to all your projects? You need to add it to the app projects as well as the PCLs.

这就是错误告诉你的.它使用一种称为诱饵和开关"的技巧,通过它在 PCL 中安装一个具有特定界面的虚拟程序集,并在 Android 和 iOS 应用程序中安装一个具有相同界面的平台特定程序集,该程序集实际上与数据库进行交互.这个想法是您针对 PCL 进行编码,但在运行时使用库的平台特定版本.您可以在 https://web.archive.org/web/20161209075521/http://log.paulbetts.org/the-bait-and-switch-pcl-trick/

This is what the error is telling you. It uses a trick called 'bait and switch' whereby it installs a dummy assembly in the PCL with a particular interface, and in the Android and iOS apps it installs a platform specific assembly with an identical interface that actually does the interactions with the database. The idea is you code against the PCL, but at run time the platform specific version of the library is used. You can read more about this pattern at https://web.archive.org/web/20161209075521/http://log.paulbetts.org/the-bait-and-switch-pcl-trick/

但本质上,此错误是告诉您尚未在特定于平台的项目中安装 NuGet 包.

Essentially though, this error is telling you that you haven't installed the NuGet package in your platform-specific projects.

这篇关于Xamarin SQLite“这是‘诱饵’"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Union in SQL while creating XML file(创建 XML 文件时在 SQL 中联合)
How to update a SQL table column with XML data(如何使用 XML 数据更新 SQL 表列)
How To Save XML Query Results to a File(如何将 XML 查询结果保存到文件)
Extracting XML sub-tags from a clob in Oracle via SQL(通过 SQL 从 Oracle 中的 clob 中提取 XML 子标签)
installed Xampp on Windows 7 32-bit. Errors when starting(在 Windows 7 32 位上安装 Xampp.启动时的错误)
Mysql lower case table on Windows xampp(Windows xampp 上的 Mysql 小写表)