Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How, or can i query multiple tables in WindowsPhone8 Application using Windows Azure Mobile Services?

Im using in my wp8 c# application a cloud database trough Azure Mobile Services. I have two tables that i connected with each other with foreign keys.

  1. MovieTable (Id,Title,length,genre)
  2. EventTable (id,date,movieId)

In my application i can query them separately like the documentation said:

so i can query my MovieTable like this

private MobileServiceCollection<MovieTable, MovieTable> items;
    private IMobileServiceTable<MovieTable> Mtable = App.MobileService.GetTable<MovieTable>();

then in my method:

int selectedId= 13;  // its coming from the user interface, not important now

items = await Mtable
             .Where(mov => mov.Id == selectedId )
             .ToCollectionAsync();

             Movietable tb = items[0];
             txtTitle.Text = td.Title;
             txtlength.Text= td.Length; 

So what im looking for is to reach all the data parts of the two table like above

     items = await Mtable,ETable    (E table is for my Event Table)
             .Where(event => event.Id == selectedId && event.Id =Mtable.Id )
             .ToCollectionAsync();

             Eventtable tb = items[0];
             txtTitle.Text = tb.Title;
             txtlength.Text= tb.Length;

and the important

             txtDate.Text= tb.date;  

I know its wrong syntax, but its just for demonstrate what im trying to reach.

in simple sql its looks like

 select * 
 from MovieTable m1,EventTable e1
 where m1.id==e1.id

So it is possible somehow through azure mobile service ?

Also i know and i already created view in Azure database management portal, but i dont know how can i reach that view in my application, i cannot found any docs about reaching those views.

like image 685
stacked Avatar asked Nov 01 '22 10:11

stacked


1 Answers

How about implementing a custom API for the mobile service? You can do the table join here instead of dragging everything down to the phone... http://blogs.msdn.com/b/carlosfigueira/archive/2013/06/14/custom-apis-in-azure-mobile-services.aspx

like image 148
Espen Medbø Avatar answered Nov 15 '22 05:11

Espen Medbø