Quan Mai
Optimizely
Quan Mai  -  CMS
Apr 30, 2026
visibility 830
star star star star star
(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

error Please login to comment.
Latest blogs
Building UI Extensions for Optimizely SaaS CMS

Introduction Developers have been extending the functionality of Optimizely PaaS CMS for years using addons built in C# and deployed as NuGet...

Mark Stott | Oct 15, 2026

Cheapskate AI Translator: Because Translation Should Not Require a Second Mortgage

There is a particular kind of software project that begins with a detailed architecture document, a product roadmap, and a carefully assembled...

Linh Doan Cuu | Oct 15, 2026

Computed Fields in CMS 13 Content Contracts with Optimizely Graph

Content Contracts in Optimizely CMS 13 allow different content types to share a common structure when querying Optimizely Graph. But what if the...

Mardy | Oct 14, 2026

Opal Workflow Agents And The Graph Webhook Trap

What we did? We built a compliance review workflow agent in Opal. The job was simple: when an editor submits a page for review in Optimizely CMS 13...

Ritu Madan | Oct 14, 2026