Categories

ISettings Interface

GrandNode has an internal engine for saving generic simplified settings. A setting has only a name and value, so it is easy to store, retrieve, modify and delete.
All settings are store in single collection, unlike other domain models.

step1

You can see Setting stored in database

step2

To start using Settings, you need to create new file, that should have postfix -Settings

step3

Your Setting class has to inherit from empty interface ISetting.
Setting class should consist of usual Properties.

step4

Usually, Settings are used in configuration by admin. 
Starting from Controller, Action GET Configure() 

step5

You firstly get all Settings of your type (let's say PayPalStandardPaymentSettings)

step6

and then you assign them to View Model, that will be returned to View

step7

After admin submit his input in Configuration, it is received by POST Configure()

step8

As usual, you firstly load settings

step10

And then, you start assigning View Model values to Setting 

step11

You also need specify this code (because of caching mechanism, there is _OverrideForStore for each Property), otherwise values won't be persistently saved

step12

 

back to top