A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
Hi Valdis,
It looks like you've got two solutions. Either the one you've posted above, or by creating a query:
ImageQuery imageQuery = new ImageQuery();
imageQuery.ImageGallery = new ImageGalleryCriterion();
imageQuery.ImageGallery.ID = new IntegerCriterion();
imageQuery.ImageGallery.ID.Value = CurrentImageGallery.ID;
ImageCollection images = QueryHandler.Instance.GetQueryResult<Image, ImageCollection>(imageQuery, 1, 1);
I would probably go for your solution as the GetImages method uses ImageGalleryFactory directly (instead of the QueryFactory), and from a performance point of view it probably has its upsides.
I find it a bit strange that there isn't an overload for the GetImages method that accepts an ImageGallery instead of an ImageGalleryCollection, but I'm sure there's a good reason for it :)
Hope this helps!
Karoline
var image = ImageGalleryHandler.Instance.GetImages(new ImageGalleryCollection(new List<ImageGallery> { blogEntry.ImageGallery }), 1, 1, EntityStatus.Approved).FirstOrDefault();