[英]Create connection between SQL Server 2008 R2 and Xamarin Android
Good morning, I'm testing the free version of Xamarin Studio and I want to connect my Android application to my database. 早上好,我正在测试Xamarin Studio的免费版本,我想将Android应用程序连接到数据库。 As I write in the title I'm using SQL Server 2008 R2 and I read that the best solution is to use a web service.
当我写标题时,我正在使用SQL Server 2008 R2,并且我读到最好的解决方案是使用Web服务。 The problem is that is the first time that I create a web service and I don't know how to do all this procedure.
问题是这是我第一次创建Web服务,但我不知道如何执行所有此过程。 Someone can guide me?
有人可以引导我吗? I found this link ( http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api ).
我找到了此链接( http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api )。 So I can create this web service using Visual Studio and then I can create the app using Xamarin Studio (right?).
因此,我可以使用Visual Studio创建此Web服务,然后可以使用Xamarin Studio创建应用程序(对吗?)。 Can I try to do this also using the free version?
我可以使用免费版本尝试这样做吗? Because I saw that System.Data.SqlLite is available only for higher version (from Business).
因为我看到System.Data.SqlLite仅可用于更高版本(来自Business)。 Please help me.
请帮我。 Thanks
谢谢
Yes, that's a way to do it. 是的,这是一种方法。 Create a WebAPI service and then access it from Xamarin using a REST client, ie HttpClient .
创建一个WebAPI服务,然后使用REST客户端HttpClient从Xamarin访问它。 You won't be needing SQLite for this, just a client that sends and receives JSON data (or any other format if you choose so).
您将不需要SQLite,只需一个用于发送和接收JSON数据(或您选择的其他格式)的客户端即可。 Here is a sample HttpClient use.
这是HttpClient使用示例。 You would also need Json (de)serializer, ie Json.net .
您还需要Json(de)serializer,即Json.net 。 Here is another complete example .
这是另一个完整的示例 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.