0
我試圖序列場地/欣欣關係在LINQ to Javascript和有很難搞清楚它們分組,基本上我已經從LINQ序列化LINQ到實體,以JSON
Venue ID | Venue Name | Party Name | Party ID
74 CityStars Cinema Late Night (3am) 2
74 CityStars Cinema Sunrise (6am) 3
74 CityStars Cinema Morning (9am) 4
74 CityStars Cinema Noon (12pm) 5
74 CityStars Cinema After Noon (3pm) 6
以下輸出眼下查詢我是這樣的:
JavaScriptSerializer rSerialize = new JavaScriptSerializer();
var enVenues = from v in db.Venues
join t in db.VenueTimes on v.ID equals t.VenueID
join p in db.VenueParty on t.PartyID equals p.ID
select new
{
VenueID = v.ID,
VenueName = v.TitleEn,
PartyName = p.NameEn,
PartyID = p.ID
};
rMovie.VenuesArray = rSerialize.Serialize(enVenues);
但是我希望做的是,把LINQ的地點名稱是這樣的:
{[
"VenueID" : 74,
"VenueName" : "CitySars Cinema",
"VenueShowtimes" : [ {"Late Night", 2}, {"Sunrise" , 3}, etc... ]
]}
我該怎麼做?