Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (47 sloc) 1.72 KB
In a .Net Core project you can feel the need to have a settings "database" that will store all your application settings, that can be hot changed by the user.

Type-DB as a Settings Provider


Imagine that your app have an admin dashboard and you want to store all your app settings, you can by example use Type-DB.

Code Sample

This sample store the DateTime at the runtime that is returned in the view, the good things with Type-DB is that you can setup persistence and when your settings will be updated, they will be persisted each time (because we use PersistenceType.Iteration)

// In Startup.cs
public Instance Instance { get; }
public Database Settings { get; }
public Startup(IConfiguration configuration)
    Instance = new TypeDB.Core(Mode.Standalone)
    .UsePersistence(new Persistence
        Type = PersistenceType.Iteration,
        Location = Persistence.TemporaryLocation
    Settings = Instance.OpenDatabase("settings", true);

    Settings.Set("date_time", DateTime.Now);

    Configuration = configuration;
public void ConfigureServices(IServiceCollection services)

// In your Controller or PageModel
public IndexModel(Database settings)
    _settings = settings;
public void OnGet()
    ViewData["DateTime"] = _settings.Get<DateTime>("date_time");

Get a full example of this use case here:

Read more about Persistence here:

{% page-ref page="../features/" %}

You can’t perform that action at this time.