Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

TL;DR;

Create a POCO configurationClass. Then you can inject yourself a IConfiguration<MyConfiguration> into your module to get and save this configuration. See our trainee project for an concrete example https://bitbucket.org/diegroupware/antony.demo.trainee.desktop/src/master/

General

antonys' configuration system consists of multiple configuration layer.

  • DefaultLayer: The default layer is “hardcoded” by the definition of your configurationClass

  • GlobalLayer: The global layer is used to create an enterprise-wise configuration

  • GroupLayer: Each user can be within a configurationGroup. You are able to configure this whole group

  • UserLayer: The user-specific configurations are stored here

  • ComputerLayer: If you want to create configurations just for a single computer, this is the layer of choice. This might contain hardware specificsSettings will be overwritten from the computerlayer upwards.

Before your start implementing your configuration you might think about which configuration you want to save in which layer. Perhaps you need two different configurations? For example you might have a global configuration for the access to your system to integrate, but also a userspecific one for saving authentication information? As said you should make the decision before you start to implement.

Define your Configuration

First you have to defined your Configuration. Therefore you need to create a POCO Class holding all your configuration values. Below you see an example configuration class. Your class needs to be attributes with the ConfigurationNameAttribute. The name is needed to access your configuration.

    [ConfigurationName(nameof(TraineeConfiguration))]
    public class TraineeConfiguration
    {

        public string MyTitle { get; set; }

        [EncryptedConfiguration()]
        public string MySecret { get; set; }

        [ConfigurationDefault]
        public static TraineeConfiguration Default => new TraineeConfiguration()
        {
            MyTitle = "Trainee",
            MySecret = ""
        };
    }

For a simple example we’ll provide a simple property MyTitle. This property is read by the module (see later) and used as a caption for the antonys FlexObject Tab. The property MySecret is an encrypted one. The configurationsystem detects these properties automatically and persists them in an encypted string. Be economical using this option, as you cannot easily by-pass antony to read them directly.

You can only encrypt string properties this way. You cannot use other types will now.

The last property is attribtues with the ConfigurationDefault attribute. If no configuration is stored with the given configurationName you will get the defaultConfiguration.

You can explicit request an configuration from a specific layer. Within this method you will not get the DefaultConfiguration

Access you Configuration

asdf

  • No labels