Reputation: 307
What is the best method to connect a Windows Phone app or Windows 8 app directly to an SQL Server?
The apps must not use a proxy/IIS etc. and was hoping to connect directly using SQL like with normal desktop applications.
Thanks.
Upvotes: 1
Views: 9169
Reputation: 5152
You can't directly connect to a SQL Server, because of the Metro-Apps-Sandbox concept. They only can comunicate with a server through a service. The only way around this limitation that I know of is a SQLite integration into Windows 8 Apps.
In my opinion the best way (if you use Visual Studio) is the EntityFramework. It seems a bit complex at the beginning, but the ORM really helps while developing (less mistakes through intellisens, more security against injections). Then you wrap it up into a WCF Data Service and you are ready to use any SQL-Database in your application.
The Entity Framework enables developers to work with data in the form of domain-specific objects and properties, such as customers and customer addresses, without having to concern themselves with the underlying database tables and columns where this data is stored. With the Entity Framework, developers can work at a higher level of abstraction when they deal with data, and can create and maintain data-oriented applications with less code than in traditional applications
You can decide between two ways:
However there are some downsides:
Here is the Page of the EF-Project. You should start there to dive into it.
Upvotes: 4