none
Database access using WCF Service in Metro App C# RRS feed

  • Question

  • Hi,

    Are there any other ways of data access instead of creating an entity data model of the database for interaction with the metro app?

    For instance, can I create a class in the data model folder of the app and use that for data access with the database instead? Perhaps from that class, I can access the service and retrieve data from the database (like an image, etc) which will then be bind with the xaml of the app. Just like how the Contoso Cookbook uses the RecipeDataSource.cs as reference for binding.  

    Thanks.

    Monday, June 3, 2013 7:25 AM

All replies

  • Sure. If you want to access a WCF service from your UI application, add a service reference to it in Visual Studio to create a local proxy class and then use this to communicate with the service. There's an example of how do this here: http://blogs.msdn.com/b/piyushjo/archive/2011/10/10/calling-a-wcf-service-from-a-metro-application.aspx
    Monday, June 3, 2013 8:34 AM
  • Hi Magnus, 

    Thanks for the reply. I've done that. However, what I want to achieve is that I want to bind the values that I get from the database into my xaml by using a class (like the Contoso's RecipeDataSource.cs). Since I'm using grid app template, I need to use that right? Can it be done? What I've noticed is that the RecipeDataSource uses JSON to get the values. Can I implement WCF service instead for that?

    Thanks. 

    Wednesday, June 5, 2013 5:30 AM