Xamarin SQLite quot;This is the #39;bait#39;quot;(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“这是‘诱饵’"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Xamarin SQLite“这是‘诱饵’"


- 导入具有可变标题的 Excel 文件 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01