Still having a little difficulty with DisplayAttribute

Is there any way to have a DisplayAttribute emit AutoGenerateField=false? No matter what I do I cannot get it to have this generated. I have tried setting it to false and not setting it at all. There is only the default constructor. The other attributes are working perfectly. I am now able to set up a ton of my ui on the data service.

Derek

ServiceStack isn’t able to do this generically as it can only emit attribute properties with non-default values.

But you can override how attributes are serialized with a custom handler where you can explicitly add attribute properties for non-default values, e.g:

var feature = GetPlugin<NativeTypesFeature>();
feature.ExportAttribute<DisplayAttribute>(x => {
    var attr = (DisplayAttribute) x;
    var metadata = feature.GetGenerator().ToMetadataAttribute(x);
    if (!attr.AutoGenerateField)
        metadata.Args.Add(new MetadataPropertyType {
            Name = nameof(DisplayAttribute.AutoGenerateField),
            Type = nameof(Boolean),
            Value = "false",
        });
    return metadata;
});