I though that uQuery worked against the XML cache.
But i noticed that this line of code does a query against the database:
if (uQuery.GetUmbracoObjectType(nodeId) == uQuery.UmbracoObjectType.Media)
This SQL statement was launched:
SELECT nodeObjectType FROM umbracoNode WHERE id = 5366
Because the UmbracoHelper replaces uquery (according to the documentation), I was searching for a way to replace this using the new API. Has anyone an idea how to do this?
var umbHelper = new UmbracoHelper(UmbracoContext.Current);
var mediaPickerContent = umbHelper.TypedMedia(nodeId);
if (mediaPickerContent == null || mediaPickerContent.ItemType != PublishedItemType.Media)
{
// do stuff
}
If null is returned it was probably NOT a Media item. To be sure I added the "item type" check.
uQuery does database hit
I though that uQuery worked against the XML cache.
But i noticed that this line of code does a query against the database:
This SQL statement was launched:
Because the UmbracoHelper replaces uquery (according to the documentation), I was searching for a way to replace this using the new API. Has anyone an idea how to do this?
Found it!
If null is returned it was probably NOT a Media item. To be sure I added the "item type" check.
is working on a reply...