如何用写好的指定DataContextClass进行分组?
我想按categoryid对dvdlist进行分组,与此类似,但没有DVDDataContext 这个有效,
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 };
我需要以下类型的代码,但错误发生在 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 };
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 };
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能在匿名类型中指定 GetTable()。尝试 { CategoryId = g.Key, GetTable= g };
希望有帮助!
You cannot specify GetTable() in anonymous types. Try { CategoryId = g.Key, GetTable= g };
Hope it helps!