开发者

Subsonic Syntax Question (with GroupBy)

Is there a way to do this :

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();

The "GroupBy" part in the last line doesn't compile... (I'm using SubSoni开发者_运维技巧c 2.1)


Just in case there isn't a reason you need the old Where construct:

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>();


With Collections you can use OrderByAsc and OrderByDesc but they both only allow passing a string as a parameter. And the SubSonic.AggregateFunction.GroupByprobably isn't what you want.

Try this instead:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜