Get part without using ContentManager/CacheManager.

Topics: Core, Customizing Orchard
Jul 18, 2013 at 5:10 PM
The usual way that I've seen of getting a part in a service looks like this:
        public LoggingSettingsPart Retrieve()
            return CacheManager.Get(
                ctx =>

                    LoggingSettingsPart settings =
                        ContentManager.Query<LoggingSettingsPart, LoggingSettingsPartRecord>().List().FirstOrDefault();
                    if (settings != null)
                        return settings;

                    settings = new LoggingSettingsPart();
                    settings.Record = new LoggingSettingsPartRecord();
                    return settings;
The issue with this is that it causes information to be logged - which is problematic if we're calling this from within a logger. So, I'm wondering if there's a way to get the part without using something that has the side effect of creating log entries.

Any help would be appreciated. Hoping I don't have to move to config or files for settings, especially since I just spent so much time getting the Logging settings showing in the admin area in a way that I liked.