Connect an azure database to existing xamarin project - c#

I am having trouble connecting my Azure database to an existing Xamarin forms project. I have followed all the steps to make the database accessible but don't understand how to connect it to the project.
I would be grateful for any help.

As CSharpRocks mentioned that Azure Mobile App would be an ideal approach for you to build your mobile backend with Azure sql database, then you could leverage the client SDK for Azure Mobile Apps in your Xamarin.Forms project to communicate with your Azure sql database.
You could follow the steps below for getting started with Azure Mobile Apps with Xamarin.Forms app:
Create your Mobile App and configure the server project, for more details you could refer to here.
Note: For Node.js backend, you could navigate to "Mobile > Easy tables" for adding new or existing tables, then it would automatically create the Node.js backend (table API) for your added table(s). For C# backend, you could download the sample server project from quickstart or create the Azure Mobile App template via VS and implement table controllers for each of your tables, for more details you could refer to adrian hall's book about Implementing Table Controllers.
For your mobile client, you could download and run the Xamarin.Forms project from quickstart to getting started with client SDK for Azure Mobile Apps. Also, you could refer to adrian hall's book about Chapter 3 - Data Access and Offline Sync > The Mobile Client.
Additionally, you could add authentication to your Xamarin.Forms app and only the authenticated and authorized users could access the table data under your Mobile App. For more details, you could refer to here.

Related

Connect two app services and easy tables in the azure protal

I would like to connect two mobile app services and their easy tables in the azure portal.
The two system have users with different read and edit rights.
The first system is read only users and the other system is admin users.
So when one user post something to a table in the first app service, it should trigger a post or event in the second app service.
The two app-services endpoints may look like this:
https:// some-random-url .azurewebsites.net/tables/posts
https:// some-other-random-url .azurewebsites.net/tables/posts
Is there some way to connect two azure mobile app services via an Api?
For easy tables, you are using the Node.js backend for your mobile app. You could leverage KUDU or App Service Editor to check your backend code, details you could follow Understanding the Azure App Service Editor.
So when one user post something to a table in the first app service, it should trigger a post or event in the second app service.
Per my understanding, azure mobile apps provide a easy way to expose your table APIs. You may internally call your second mobile app endpoint within your first mobile app with the relevant authentication. Moreover, I would recommend you follow 30 DAYS OF AZURE MOBILE APPS for a better understanding of Azure Mobile Apps.
Additionally, you could provide more detailed scenario for your issue, then we could provide other better solution for you to implement your requirement.

How to connect windows phone 8 to database and apply azure sync data to it?

What is the best possible way to connect your windows phone 8 application with the database?Which is the best option? I want to make synchronization possible to that app database and azure SQL database.So the ultimate goal is to update the azure database and view the output on phone app even while it is offline.
Provide appropriate links & tutorial wherever possible.
Build an ASP.NET MVC WebAPI server, hosted as an Azure website, which connects to your database. Then the Windows Phone can talk to the server using a RESTFUL interface, ie JSON carried by HTTP.
Store data on the phone in local storage. I really would not try to run a database on Windows Phone.
See Microsoft ASP.NET Web API > Overview and Getting Started: http://www.asp.net/web-api/videos/getting-started
Wikipedia > Representational state transfer: https://en.wikipedia.org/wiki/Representational_state_transfer
MSDN > HttpClient Class: https://msdn.microsoft.com/en-us/library/system.net.http.httpclient(v=vs.118).aspx

Azure Mobile Service SQL Database Connection

I am using azure mobile service which has a sql database. I would like to get a connection between my windows phone app and azure mobile service sql database. How can I achieve it?
In TodoItem example, there is no any table information that data will be taken.
P.S. : Googled a lot but nothing satisfied even azure documentation. TodoItem example does not show some details. For example my database table name is Scores where code line should I edit in TodoItem example?
You can download TodoItem example here.
in Azure Mobile Service, you don't access the database directly from your mobile application. you talk to the Mobile Service backend which in turn talks to your database.
as #hSchroedl mentioned, you should use the Mobile Service API to access your database tables.
You can easily follow the TodoItem sample to create representations of your own tables.
If your question is how do I get my Azure Mobile services database connection string, then the answer is: look in the Azure portal -> your Mobile Services name -> Dashboard tab -> Click on your database name. There you have your database connection string.
You can use this connection string in Visual Studio to connect to your Mobile Services database but can't be used directly in your mobile app.
Note: You can't access your database directly from your mobile app without using the Azure Mobile Services APIs.
Take a moment and review the Azure Mobile services documentation and tutorials to get a better understanding of it works.
Hope this helps

Setting up Entity Framework based WebAPI service that authenticates using Windows Live ID?

I have a WinRT app that is going to interact with a WebAPI service on my server backed by an Entity Framework managed SQL database (MVC - ASP.NET). For security, I'm only allowing users authenticated on the WinRT side with the Microsoft Live Connect SDK to interact with the WebAPI service. I already have the login code for authenticating with the Live Connect SDK on the WinRT app side working. The WebAPI service is running in the context of an MVC Web Role running on my Azure hosted server.
I've done a lot of reading on StackOverflow and there's a wide range of documents on the topics of authentication, OData, OAuth, Azure Mobile Services, WebAPI and how to combine them:
Live Connect Authentication Token for use on Azure Mobile Services (REST)
How to use a MVC WebAPI OData endpoint securely?
Disable Windows Authentication for WebAPI
I am very concerned that I choose the tools/path that implements only what I need to implement the above scenario and in a secure manner. My main attack concern is un-authenticated users trying to access the ApiController and performing harmful Puts or Deletes. Some questions:
Do I need Azure Mobile Services at all?
What tool(s) do I use or configuration changes do I need to make to manage/pass the Live Connect token between the WinRT app and the service?
Is there a template or NuGet package that I should use that automates much of this?
Is there a document that addresses my scenario or one close to it?
Is there anything built-in to Entity Framework that can help, or conversely has a vulnerability I need to address? If so, what?
What changes do I need to make to the server configuration (web.config)?

How to deploy a web application with WCF as a cloud service using Windows Azure Pack?

We want to develop a web application as a cloud service on windows Azure. The application has the following architecture:
This application was a simple line of business winforms application, where any customer could purchase and use it. Now our company decided to redesign it as a web application where many customers can work on it in the same time. The core application will stay the same, just some simple customizations, it does some simple tasks in the database and sending emails and other things.
Now, Our company decided that we need to use windows Azure to publish the web application as a could service. We don't need to use any of the Azure storage nor SQL Azure database services, instead we will use our datacenter's storages and database. We just need to deploy the application as a cloud service, and we don't know where to start. I couldn't understand how to use windows Azure cloud services in this application. So my questions are:
Is this architecture valid with windows Azure? And where would be the role of Windows Azure and its cloud services in this archticture?
We don't need to host the application on Microsoft datacenters, instead we need to use it in our datacenter, when I searched I found the Windows Azure Pack for Windows Server, so can we use it so that we can host it in our datacenter? Does we need any extra cost consideration to use it? Where to start to use in our application?
I found some posts and tutorials (like this one here in SO) saying that I just have to create a new Window Azure Project and add a WCF Service Web Role, copy the application files from the old Web Service then host the same as a web application. Is that true? Is windows Azure just involved in the deployment and it doesn't has any effects in the internal architecture of the application?
You can deploy both your UI and Service back-end to Azure Web Roles. If you have any remaining WinForms application, they still can connect to the Service back-end. I would recommend that you also deploy your database to Azure if possible to improve performance and reduce latency. You can either use Azure SQL Database or you can create a SQL Server VM.
There are various interesting options to deploy layered applications to Windows Azure. You can read more about it here. http://serena-yeoh.blogspot.com/2014/01/layered-applications-and-windows-azure.html
You can also checkout a simple sample here
http://cloudsample.codeplex.com

Categories

Resources