How to group with a written specified DataContextClass?
I want to group dvdlist by categoryid, Similar to this, but no DVDDataContext This one works,
DvdDataContext db = new DvdDataContext();
var q = from b in db.DvdLists
group b by b.CategoryId into g
select new { CategoryID = g.Key, DvdLists = g };
开发者_如何学运维I need the following kind of code, but the error occurs at GetTable()=g
DataContext db = new DataContext(conString);
var dvd = db.GetTable<DvdList>();
var query = from b in dvd
group b by b.CategoryId into g
select new { CategoryId = g.Key, GetTable<DvdList>()= g };
You cannot specify GetTable() in anonymous types. Try { CategoryId = g.Key, GetTable= g };
Hope it helps!
精彩评论