This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C# : Set a default value for MFIdentifier in Configuration

Hello, 

In a VAF application, I want to show the MFidentifier in configuration panel. But I can't make the default value work. It's always marked as error. For example:

[DataMember]
[MFPropertyDef(Required = true)]
public MFIdentifier mfIdPropActeur = "PD.SOCLE.Acteur";

[DataMember]
[MFPropertyDef(Required = true)]
[JsonConfEditor(DefaultValue = "PD.SOCLE.Action")]
public MFIdentifier mfIdPropAction = "PD.SOCLE.Action";

The question is simple : how to make work? How to specify 

Thanks,

Amaury Bianchi

Parents Reply Children
  • The value isn't mandatory within the configuration, though.  The value is mandatory at runtime, but this attribute isn't checking that; it's checking whether the value exists in the JSON configuration.

    Within your application you should be checking the runtime value to see that it's resolved (e.g. "if(false == this. Configuration.mfIdPropActeur.IsResolved)").  You can do this both when your methods run and also by providing additional Custom Configuration Validation (m-files.com)configuration validation.

    I do see the argument that the mapping could/should show the property name if one matches the alias you're providing, but it currently does not unless an explicit value is added.

  • You are right, I will write a custom validator instead of using the "required" tag.

    I am a little disappointed it is not that straightforward sometimes, I was really hoping the property properly shown in the configuration if the default one is in the code.

    Thanks.