문제

I am using Glass library as ORM for Sitecore. I have a field Images which contains the list of images. Since I want to access this from my .NET code, I have written a partial class which has the field images like:

[SitecoreField]
public virtual IEnumerable<Glass.Sitecore.Mapper.FieldTypes.Image> Images { get; set;}

But while loading this I am getting error.

The method or operation is not implemented.

Where as I am able to access the single image through Glass, without writing any additional code.

Can anyone please suggest something to fix this?

도움이 되었습니까?

해결책

Our architect has solved this issue with the help of creator of Glass library. And the solution is like this..

    [SitecoreField]
    public virtual IEnumerable<MediaImage> Images { get; set;}

And Media Image is class like:

     [SitecoreClass]
public class MediaImage
{
    [SitecoreField("Attachment")]
    public virtual Stream Image { get; set; }

    [SitecoreInfo(SitecoreInfoType.MediaUrl)]
    public virtual string Url { get; set; }

    [SitecoreField("Alt")]
    public virtual string Alt { get; set; }
}

This has solved the issue and I am getting the list of images now.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top