Limitation in the binding of interfaces

Posted by: gennadiy_lenivenko on 14 January 2020, 4:10 am EST

  • Posted 14 January 2020, 4:10 am EST

    Hi colleagues.
    Finally, I have found the reason for the problem with binding in FlexGrid.
    It appears not only with indexed properties, it appears with binding interfaces
    For example. Try to use next hierarchy (2 interfaces and 2 classes). Property “Name” is defined in the root(!!!) of the hierarchy”:

    public interface IFirst { public string Name { get; set; } }
    public interface ISecond : IFirst { public int Amount { get; set; } }
    public class BaseClass : ISecond { public string Name { get; set; } public int Amount { get; set; } }
    public class DerClass : BaseClass { }

    And then, try to bind tree collections to the FrexGrid:

    List<ISecond> data1; //Binding is broken for property “Name”
    List<BaseClass> data2; //Ok.
    List<DerClass> data3; //Ok.

    The reason is…
    Inside class “C1.Blazor.Core.ExpressionEx”, inside function “GetPropertyPathExpression” you can find call of standard function “Expression.Property(expression1, propertyName)”.
    If you decompile it, you can find that it uses function “expression.Type.GetProperty(propertyName, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags. Public | BindingFlags.FlattenHierarchy);”
    This function works fine with classes but works “bad” with interfaces. In other words, it can find property “Name” inside “BaseClass”, “DerClass” and “IFirst”, but cannot find this property in “ISecond” and throws exception.

    Could you fix this limitation?

    PS. sorry I cannot make ticket. It has not "Blazor" in combo :-(
  • Replied 14 January 2020, 4:25 pm EST

    Hi Gennadiy,

    We were able to replicate the issue at our end and have forwarded it to the dev team with internal tracking id 417096. We will update you as soon as we will hear from them.

    Regarding Blazor not available in SupportOne, we have forwarded this issue to the concerned team.

  • Replied 14 January 2020, 11:34 pm EST

    Thank you, Ashwin.
  • Marked as Answer

    Replied 26 February 2020, 6:04 pm EST

    Hi Gennadiy,

    The issue has been fixed in the latest build of Blazor (3.1.20193.437). Please update the blazor version in your application and verify the fix.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels