var nonPromotedContent = contentRoot.Descendants("ArticleDocType")
.Where("Promoted != true")
.Where("HasAccess")
.OrderBy("articleDate desc")
;
var content = promotedContent.Concat( nonPromotedContent );
@foreach( var n in content){
@renderArticle(n)
}
True/False Datatype in Linq like Where(...) how to match false and DynamicNull
Hi,
I'm struggling with True/False datatype in a Linq Where query.
I'm trying to order some articles, if they are Promoted then have them at the top and the rest follow on.
I've added the true/false property "Promoted" late, so many many articles don't have it set.
From razor walkthrough part5 It should return a type of DynamicNull if the property has not been set.
I've inferred that .Where("Promoted != true) should match this DynamicNull too, but it doesn't....
so how do I work with a true/false datatype property added late?
Ade
var promotedContent = contentRoot.Descendants("ArticleDocType") .Where("Promoted == true") .Where("HasAccess") .OrderBy("articleDate desc") ;
is working on a reply...