Skip to content

Instantly share code, notes, and snippets.

@gerhart92
Created July 29, 2021 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerhart92/dc7d6b51acbca51ff841a53106a8102d to your computer and use it in GitHub Desktop.
Save gerhart92/dc7d6b51acbca51ff841a53106a8102d to your computer and use it in GitHub Desktop.
private IEnumerable<Family> _families;
public virtual IEnumerable<Family> Families
{
get
{
if (_families != null)
{
return _families;
}
GetItemsByQueryOptions builder = new GetItemsByQueryOptions();
builder.Query = new Query("/Families");
builder.InferType = true;
builder.TemplateId = "{E7A480B9-F931-4D37-AA56-58264A26F49F}";
builder.RelativeItem = Sitecore.Context.Database.GetItem(new ID(this.Id));
return new RequestContext(new SitecoreService(Sitecore.Context.Database)).SitecoreService.GetItems<Family>(builder);
}
set
{
this._families = value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment