Quan Mai
Quan Mai  -  CMS
Apr 30, 2026
  42
(0 votes)

Announcing new library: SettingsManager

When you run .net app, there have been a few ways to store settings. Those can be set via appSettings.json, or via Azure Portal AppService Configuration. However those setting changes require a restart (or even worse, a re-deployment), which is not always something you'd like nor can affort. To support changing settings on a fly, some of our customers have relied on a content approach - by creating a special page containing the settings as properties - which is a nice way to do it, as you have everything you need - you have a nice UI to set the value, you can set the access rights to who can see the settings and who can change them. The settings also support distributed manner, once you publish the page with new property values, the new values will be seen across the instances. 

But that is not without caveats. Reading settings is usually a very hot path, and if you rely on the content API to get the page then the property you need, you could create a severe bottleneck in your website. At best, it creates a lot of unnecessary allocations. At worst it could create infinite loops when you have multiple threads trying to read and write data to cache.

To address those problems, I have created a new library at GitHub - vimvq1987/SettingManager: A setting manager for Optimizely CMS · GitHub as a proof of concept for how you can leverage Content system for settings while avoid those performance issues. I'll eventually submit the nuget package to https://nuget.optimizely.com, but you can start using the library today (just download and build)

What you need to do is to define your content type of setting page, which inherits from SettingsPage

    [ContentType(DisplayName = "Setting page", GUID = "452d1812-7385-42c3-8073-c1b7481e7b22", Description = "", AvailableInEditMode = true)]
    public class MySettingPage : SettingsPage
    {
        public virtual string ASetting { get; set; }
    }

Then register your type you want to use with this in your Startup.cs

services.AddSettingPage<MySettingsPage>()

And then use SettingsManager to get the setting on the fly.

var setting = _settingManager.GetSetting<string>("ASetting");

A setting page will be create per site definition, and you can get site-specific settings. If no site definition is specified, the current site definition will be used.

Settings will be cached and will be automatically cleared if you making change to the page (by changing properties and publish). This works across instance.

As I said this is a pretty much POC, so I'll be happy to receive comments, suggestions, bug reports or fixes to the repository.

Happy coding!

Apr 30, 2026

Comments

Please login to comment.
Latest blogs
From Prompting to Production: Optimizely Opal University Cohort and the Future of Agentic MarTech

Most organizations today are still playing with AI. They experiment with prompts, test ideas in isolated chats, and occasionally automate a task or...

Augusto Davalos | Apr 28, 2026

Six Compelling Reasons for Upgrading to CMS 13

Most software updates ask you to keep up. Optimizely CMS 13 asks something different — it asks whether your digital strategy is built for a world...

Muhammad Talha | Apr 28, 2026

Optimizely CMS 13 breaking changes: GetContentTypePropertyDisplayName

When upgrading from CMS 12 to 13, resolving property display names may not work as before. Here’s what changed.

Tomas Hensrud Gulla | Apr 27, 2026 |