Calling .ToString() on editor not returning enum name

30 Views Asked by At

I'm trying to call .ToString() on the editor to get the friendly text for a rule. Either I'm not configured correctly or perhaps there's a bug, hence why I'm reaching out.

When calling .ToString(), the result looks like: Check if Products contain and Medical.NetworkType_BuiltInNetwork is "Y"

However, it should read like (notice that 'medical' is in the text): Check if Products contain Medical and Medical.NetworkType_BuiltInNetwork is "Y"

I'm only seeing the issue when on the server. The UI is rendering as expected.

Here's my rule Xml:

<?xml version="1.0" encoding="utf-8"?><codeeffects xmlns="https://codeeffects.com/schemas/rule/41" xmlns:ui="https://codeeffects.com/schemas/ui/4"><rule id="31be4f36-26c0-423b-a178-c2d04ab8ca4c" webrule="5.1.16.4" utc="2024-03-12T22:12:52.4714" type="Models.Root, Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" eval="true"><definition><and><condition type="contains"><property name="Products" /><value type="Models.Enums+ProductType, Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">1</value></condition><condition type="equal" stringComparison="OrdinalIgnoreCase"><property name="Medical.NetworkType_BuiltInNetwork" /><value>Y</value></condition></and></definition><format><lines /></format></rule></codeeffects>

Here's a simplified version of my model:

    public class Root
    {
        public List<Enums.ProductType>? Products { get; set; } = new();
    }

and a simplified version of my enum:

        public enum ProductType
        {
            [Description("Medical"), EnumItem("Medical")] Medical = 1,
            [Description("RX"), EnumItem("RX")] Rx = 2,
            [Description("Dental"), EnumItem("Dental")] Dental = 3,
            [Description("Vision"), EnumItem("Vision")] Vision = 4,
            [Description("COBRA"), EnumItem("COBRA")] Cobra = 5,
        }

Am I'm doing something wrong? Any help is greatly appreciated.

0

There are 0 best solutions below