I'm following this guide to build a simple rendering. https://doc.sitecore.com/developers/sxa/17/sitecore-experience-accelerator/en/walkthrough--building-a-simple-rendering.html

When I'm trying to use the ServiceLocator It can't find the right reference for it. I'm clueless to which one it should use, as they don't specify it in the walk-though.

I read somewhere that it's supposed to come from the StandardController. But when I'm looking through it, it doesn't seem to contain it.

public class SimpleComponentController
    private readonly ISimpleComponentRepository _repository;

    public SimpleComponentController()
        _repository = ServiceLocator.ServiceProvider.GetServiceISimpleComponentRepository()


Help is appreciated.

Browse other questions tagged or ask your own question.