Quan Mai
Quan Mai  -  CMS
Apr 30, 2026
visibility 627
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
Optimizely Commerce 14 Now Supports .NET 10

In my previous post, Optimizely CMS 12 Now Fully Supports .NET 10 , I noted one remaining limitation: Commerce 14 (Commerce Connect) did not yet...

Bien Nguyen | Aug 7, 2026

The Top 10 Things I'm Actually Using AI For

A while back I wrote about ReviewPR, an Azure Function that uses AI to review Azure DevOps pull requests. That was one specific use case, but over...

KennyG | Aug 5, 2026

Drag-and-Drop Reordering for Commerce Media Collection in Optimizely Commerce Connect

Optimizely Commerce Connect ships a polished asset editor for the CommerceMediaCollection  property on catalog entries. It lets editors add, remove...

Linh Doan Cuu | Aug 5, 2026

Order tabs with drag and drop V2

I earlier did a very simple Blazor version to be able to sort tabs with drag and drop. I wanted to update it a bit and also display how the tabs ar...

Per Nergård (MVP) | Aug 4, 2026