Azure Mobile Service SQL Database Connection - c#

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

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.

Connect an azure database to existing xamarin project

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.

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

Can i use my own database in Azure mobile services for Windows Phone 8.1 apps?

When creating a new service for my Windows Phone 8.1 database is also created for that service.
Instead of using service created database, can I use my own database which is located in webhost4life.com? Can I use this database, located on that server, for data adding.
By default, whenever you create a mobile service, you're required to specify a SQL database as well. You do not need to use this database. You can connect to any database you want to, from your mobile service backend code, and do whatever you want.
Just note that might need to create custom API calls, rather than the built-in CRUD operations, since the CRUD operations take advantage of a table class derivative that takes care of a lot of ORM-based things for you. If you plan on bypassing all of that, then the custom API route will let you do that.
Yes you absolutely can ! Check out this blog post on how to connect mobile services to a MongoDB backend. You just need to overwrite the backend scriptlets to handle the CRUD operations http://blogs.msdn.com/b/azuremobile/archive/2014/04/14/creating-mongodb-backed-tables-in-azure-mobile-services-with-net-backend.aspx
When you create a mobile service,a SQL database is required by default. But Microsoft Azure also provide options to make it easy to take advantage of existing assests in building a mobile service. Supported assets include any resource that runs on a static TCP port, including Microsoft SQL Server, MySQL, HTTP Web APIs, and most custom web services.
See details at https://azure.microsoft.com/zh-cn/documentation/articles/mobile-services-dotnet-backend-use-existing-sql-database/ and https://azure.microsoft.com/zh-cn/documentation/articles/mobile-services-dotnet-backend-hybrid-connections-get-started/

Connect to a SQL DB hosted on azure through a windows store app

I want to be able to connect to my DB on the azure platform and pull down some data from a table, using a windows store app in c#.
I have done this before in asp.net, but I know that the libraries for this type of thing are different when using windows store app.
Could anyone point me in the right direction?
Thanks,
Callum
You won't be able to connect directly to your Azure database from a Windows Store app, because a firewall prevents direct access - you need to add each IP address individually. It would also be incredibly insecure.
Instead, create a simple API which your Windows Store app can call - use WebAPI in C# for example. You can host this on an Azure Web Site, and it can act as the gateway between your Windows Store app and the database.

Categories

Resources