WP 8.1 native + ASP.NET MVC App with Entity Framework RRS feed

  • Question

  • Hello,

    i should write a Client-Server Application, white consists of a native WP 8.1 app and a web browser Part.

    The Windows Phone should take pictures, save them into defined picture albums in Smartphone and send this albums to a databse. The client from a browser should be able to access this captured pictures from a web browser, merge and split picture albums per drag-and-drop with JQuery/Ajax. 

    Essentially that is a data-exchange app between the client and the server.

    Now i am not sure how should i structure the architecture of the System. I have started with a web browser part, implemented a small MVC app, that uses Entity framework and its data. I will upload the whole Project to the Azure Cloud.

    The two things i do not find out yet, is

    1. how can my Windows Phone App in the same solution communicate with the same Database through this Entity Framerwork, how should it access the same Database

    2. how can i save captured pictures in the database? or should i send each image to a server and just save an ID and a URL of this picture so that i can just pass the URL in the <img/> Tag in my browser?

    Sorry for so many questions. I am just a beginner...

    Thank you in advance.

    • Moved by Bob Beauchemin Wednesday, October 28, 2015 4:06 PM Moved to a more relevent forum
    Wednesday, October 28, 2015 10:16 AM


All replies

  • 1. On Windows Phone you don't have any Kind of data access component, so it can not directly access the database, it all has to be done via a web service.

    2. see 1.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Wednesday, October 28, 2015 10:44 AM
  • Greetings!!!

    Here what you can do to proceed.

    Answer-1: In order to communicate your mobile platform base app with remote database, you need to create either REST base Web API or SOAP base Web Service at the server end to make either JSON or Form content calls to server from windows phone. Your Windows Phone app will hit the Web API or Web Service which in return will send you back the data that you want to retrieve from the remote database in either JSON or Form content format. You can explore HttpClient or WebClient libraries to hit the server side Web API or Web Service.

    Answer-2: In order to save a picture in database, there are two approaches which are followed. First is to upload the picture on the server and store the link in the database, then simply retrieve the link from the database and access the picture. Second option is to encode your picture into base64 byte format or in any other byte format and store it directly into the database and when you want to access the picture simply get the byte data from server and decode the byte image to display on device. First approach is preferred usually for many reason, one would be that it will reduce the Internet MB's consumption and save device storage space.

    Thanks & Regards

    Asma Khalid


    Mark the answer, If this helps you.

    Thanks & regards, Asma Khalid

    Wednesday, October 28, 2015 10:59 AM
  • Additional: You can use OData, it's easy to implement, but because of XML usage it creates some data traffice Overhead; see OData client for Windows Phone 8

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Wednesday, October 28, 2015 11:07 AM
  • Hello! Thank you so much for your quick reply! i will slowly develope my application according your recommendations. I am just starting to look for some tutorials to this topic. In one of them they create also linQ classes. Are they necessary?
    Thursday, October 29, 2015 3:38 PM
  • Thank you!  ok I see that OData is equal to Entity Framework. Which type of Application in conceptuality of WP does match - WCF or Silverlight? because  these two types seem to have common aims...
    Thursday, October 29, 2015 3:50 PM
  • Thank you!  ok I see that OData is equal to Entity Framework. Which type of Application in conceptuality of WP does match - WCF or Silverlight? because  these two types seem to have common aims...

    No, OData does not equal to Entity Framework.


    OData defines an abstract data model and a protocol that let any client access information exposed by any data source.



    Object-relational mapping (ORM, O/RM, and O/R mapping) in computer science is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.



    Entity Framework (EF) is an open source<sup class="reference" id="cite_ref-1">[1]</sup> object-relational mapping (ORM) framework for ADO.NET, part of .NET Framework.


    Thursday, October 29, 2015 6:03 PM