Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm having some trouble with the filter again..
var filter = SqlContext.Query<IContent>().Where(x => x.IsCulturePublished(culture)) IEnumerable<IContent> items = contentService.GetPagedDescendants(pageId, page, pageSize, out long TotalChildren, filter, Ordering.By("date", Direction.Descending, null, true));
I'm getting this... "An object reference is required for the non-static field, method or property SqlContext.Query
And if i add
new SqlContext.Query<IContent>().Where(x => x.IsCulturePublished(culture))
Then I get "The type name Query<> does not exits in the type SqlContext
Am I using it wrong?
Hi Thomas,
I assume that you are trying to achieve this in a static method?
Please consider to make this method non-static and the error should disapear. Otherwise you would have to create a new Instance of "SqlContext" and Call .Query<>() on the new instance.
For more information: https://www.codeproject.com/Questions/685831/error-An-object-reference-is-required-for-the-non
~ Jonathan
You could just inject it if using V8 and a static method and/class
ISqlContext _sqlContext = Current.Factory.GetInstance<ISqlContext>(); IQuery<IContent> filter = _sqlContext.Query<IContent>().Where(x => x.ContentTypeId.Equals(descendantType.Id));
That works well.
A bit late but hopefully it helps someone. Not sure if there is a better way of doing it though.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Umbraco 8 - GetPagedDescendants filter
I'm having some trouble with the filter again..
I'm getting this... "An object reference is required for the non-static field, method or property SqlContext.Query
And if i add
Then I get "The type name Query<> does not exits in the type SqlContext
Am I using it wrong?
Hi Thomas,
I assume that you are trying to achieve this in a static method?
Please consider to make this method non-static and the error should disapear. Otherwise you would have to create a new Instance of "SqlContext" and Call .Query<>() on the new instance.
For more information: https://www.codeproject.com/Questions/685831/error-An-object-reference-is-required-for-the-non
~ Jonathan
You could just inject it if using V8 and a static method and/class
That works well.
A bit late but hopefully it helps someone. Not sure if there is a better way of doing it though.
is working on a reply...