This project is read-only.
Creating complex queries
Let's say you need to make such query in mql:
[{
    type: "/music/artist",
    name: "The Scorpions",
    id: null,
    album: {
        name: null,
        limit: 3,
        genre: [
            {
            }
        ]
    }
}]
C# code equals to json above is:
      dynamic artist = new ExpandoObject();
      artist.type = "/music/artist";
      artist.name = "The Scorpions";
      artist.id = null;
      artist.album = new Dictionary<Object, Object>();
      artist.album.Add("name", null);
      artist.album.Add("limit", 3);
      artist.album.Add("genre", Freeb.CreateArrayWithEmptyObject());


If you want mor ecomplex query like this:
 [{
   "name":null,
   "id":null,
   "type":"/film/editor",
   "film":[{
   	   "name":null,
	   "id":null,
	   "starring":[{
	      "actor":"Theresa Russell"
	   }]
   }]
 }]

Equal C# code:
     dynamic editorsForTheresaRussel = new ExpandoObject();
     editorsForTheresaRussel.name = null;
     editorsForTheresaRussel.id = null;
     editorsForTheresaRussel.type = "/film/editor";
     editorsForTheresaRussel.film = new Dictionary<Object, Object>() {
         {"name",null},
         {"id",null},
         {"starring",new Dictionary<Object,Object>()
             {
                 {"actor", "Theresa Russell"}
             }
         }
     };

Last edited Dec 27, 2012 at 7:06 AM by F0rc0sigan, version 2

Comments

No comments yet.