2010-08-26 35 views
0

有沒有辦法做到這一點:亞音速語法題(帶的GroupBy)

SubSonic.Where filter = new SubSonic.Where(); 
filter.ColumnName = Region.Columns.Region; 
filter.Comparison = SubSonic.Comparison.IsNot; 
filter.ParameterValue = null; 

SubSonic.Aggregate orderBy = new SubSonic.Aggregate(Region.Columns.RegionName, SubSonic.AggregateFunction.GroupBy); 

RegionCollection regions = new RegionCollection().Where(filter).GroupBy(groupBy).Load(); 

在最後一行不編制了「的GroupBy」的一部分......(我使用亞音速2.1)

回答

0

萬一沒有你需要的老凡構建一個原因:

SubSonic.Aggregate groupBy = new SubSonic.Aggregate(Region.Columns.RegionName, SubSonic.AggregateFunction.GroupBy); 

RegionCollection regions = new SubSonic.Select(groupBy).From(Region.Schema).Where(Region.RegionColumn).IsNotNull().ExecuteAsCollection<RegionCollection>(); 
0

使用集合,您可以使用OrderByAscOrderByDesc但它們只允許傳遞字符串作爲參數。而SubSonic.AggregateFunction.GroupBy可能不是你想要的。

試試這個:

var result = new RegionCollection().OrderByAsc(Region.Columns.RegionName).Load(); 
+0

對不起,我的意思的GroupBy :( – mrmuggles 2010-08-27 13:11:35