The current source generating infra requires you to have some public class members exposed that the generated code can set. Instead of this, you can make the Extensions class partial and just generate another "part" of the very same class. That way you have access to internal/private members instead and can leave your public API surface much cleaner!