简体   繁体   English

如何在Xamarin中安装.net mongodb驱动程序nuget包

[英]how to install .net mongodb driver nuget package in xamarin

does Xamarin work with the .NET mongodb drivers? Xamarin是否可以与.NET mongodb驱动程序一起使用? Tried to install the Mongo 2.2.3 package via Nuget but get the following error: 试图通过Nuget安装Mongo 2.2.3软件包,但出现以下错误:

Adding MongoDB.Driver...
Attempting to resolve dependency 'MongoDB.Bson (≥ 2.2.3)'.
Attempting to resolve dependency 'MongoDB.Driver.Core (≥ 2.2.3)'.
Adding 'MongoDB.Bson 2.2.3' to mdb.
Could not install package 'MongoDB.Bson 2.2.3'. You are trying to install this package into a project that targets 'Xamarin.iOS,Version=v1.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Does anyone have experience with this?? 有人对这个有经验么??

thank you, 谢谢,

Chris 克里斯

The MongoDB.Bson NuGet package only supports .NET 4.5 so you cannot install it into a Xamarin.iOS project. MongoDB.Bson NuGet程序包仅支持.NET 4.5,因此无法将其安装到Xamarin.iOS项目中。

If you want to use MongoDB then you will most likely need to create a back end service that talks to MongoDB that your mobile app talks to over http. 如果要使用MongoDB,则很可能需要创建一个与MongoDB对话的后端服务,您的移动应用程序可以通过http与之对话。

There are third party hosting companies, such as mLab , that provide a REST API to access a MongoDB. 有第三方托管公司,例如mLab ,提供了REST API来访问MongoDB。

Otherwise you could look at Couchbase as an alternative which has support for Xamarin.Android and Xamarin.iOS through Xamarin's component store. 否则,您可以将Couchbase视为替代产品,它通过Xamarin的组件存储支持Xamarin.Android和Xamarin.iOS。

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

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