ProductCollection select = new
Select(Product.SupplierIDColumn).From<Product>().Distinct()
.ExecuteAsCollection<Pro开发者_开发技巧ductCollection>();
http://subsonicproject.com/docs/Distinct
From above example I am trying to get distinct category from my table but many problems comes
- I can not put column like this
Product.SupplierIDColumn
I dont know why my classEventListing
has no intellisense for these columns Distinct()
function is not available afterFrom<EventListing>()
.
Interestingly, it looks like the SqlQuery class in SubSonic 2 had a Distinct() method, but the SqlQuery class in SubSonic 3 does not. You could try SS2 instead of 3, or if you are using 3, I suggest using Linq expressions instead. In other words, something like:
var data = (from x in db.Products
select x.SupplierId)
.Distinct();
-or-
var data = db.Products.Select(x => x.SupplierId).Distinct();
精彩评论