Advanced programming


Configuration properties are a special variant of persistable properties. Unlike the local properties in section 1, they cannot be read or written from a proxy object using network access. Therefore, A WPF data binding to this property is not possible. Configuration properties are the most primitive variant of storeable properties. They are primarily used to set the behavior of an ACComponent (server-side instance or business objects).

The value of a configuration property can be changed either by the ACComponent itself or in the development environment in the Configuration tab.

Technically, the value of a configuration property is stored in as an entry in the ACClassConfig table. Please refer to the "Configuration" section for more information, because the actual configuration is larger than just saving configuration properties.


First, the following code example:

 

Configuration properties are instances of the generic class gip.core.autocomponent.ACPropertyConfigValue<T> .

  1. Declare a private field of this type.
  2. Declare a public property with getter and setter that encapsulates access to the ACPropertyConfigValue-Instance. In the getter and setter method, read or set the ValueT property.
  3. Use the ACPropertyConfig attribute class to register the configuration property to the iPlus type system.
  4. Instantiate the ACPropertyConfigValue class in the constructor or the overriden ACInit() method in your derived class ACComponent. In the constructor of the ACPropertyConfigValue class, you pass the this pointer of the ACComponent in the first parameter. In the second parameter, you specify exactly the same name as you declared your configuration property in the C#-code (step 2). The third parameter is the default value. Please note that the default value is only set when the ValueT property is first accessed and a new entry is made in the ACConfig table.

 

Important: Caching!

Please keep in mind that config values are cached. If ValueT is accessed several times, a fresh database query is not performed. Explicitly call the ACComponent.ResetConfigValuesCache() method to reset the cache and force it back to load from the database.